Write a program to read and print a text file on screen



Write a program to read and print a text file on screen..

Answer / ashwek

/// Using C++

#include<iostream>
#include<fstream>
#include<stdio.h>

int main(){

char Data[200];
ifstream File("FILE_NAME"); //Opening a File

while(File){ //Run until End of file
File.getline(Data, 200); //Read data from file & store in Data (string)
cout<<Data; //Print data
}
File.close();

return 0;
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Programming Languages AllOther Interview Questions

WS-NUM PIC S9(05)V(02) SIGN TRAILING SEPARATE MOVE '0050000+' TO WS-NUM The value stored is 00500,00+ MOVE '0050000-' TO WS-NUM Then what is the value will be stored in WS-NUM? Am getting '-00500,00'.....>>> What should I declare to WS-NUM so that I can get correct values for both + & - signs.

0 Answers  


why we use static with only main()class not with other class

2 Answers   TCS,


As per interoperatbility programs written in one language can be used by other language. How can we restrict the features of one language (say C#) in the programmer written in another language (say VB)..for example we have some features like operator overloading which is possible C#.NET (not in VB.NET), how can we restrict that when we are using this code in VB.NET.

0 Answers   Tesco,


What is Meaning of Windows Application & the use of Windows Applications? with Description.

1 Answers  


In Bioinformatics, a DNA sequence is made up of a combination of 4 characters, namely “A,C,G,T”. A subsequence of a given sequence of characters a0, a1, …an- 1, is any subset of the characters taken in order, of the form ai0 , ai1 ,…..aik-1 where 0 &#8804; i0 <i1….< ik-1 &#8804; n-1. For example in the sequence “A,C,G,T,G,T,C,A,A,A,A,T,C,G”, we can have subsequences “A,G,T”, “A,C,A,A” and many more. A subsequence is palindromic if it is the same whether read left to right or right to left. For instance, the sequence “A,C,G,T,G,T,C,A,A,A,A,T,C,G”, has many palindromic subsequences, including “A,C,G,C,A” and “A,A,A,A” (on the other hand, the subsequence “A,C,T” is not palindromic). Devise an algorithm (using dynamic programming) that takes a sequence of characters X[0 … n-1] from the alphabet set (A,C,G,T) and returns the (length of the) longest palindromic subsequence. Implement the algorithm in an appropriate language.

1 Answers  






why we use abstract in awt?

0 Answers  


Create a class TicTacToe that will enable you to write a complete program to play the game of Tic-Tac-Toe. The class contains as private data a 3- by-3 double array of integers. The constructor should initialize the empty board to all zeros. Allow two human players. Wherever the first player moves, place a 1 in the specified square; place a 2 wherever the second player moves. Each move must be to an empty square. After each move determine whether the game has been won and whether the game is a draw. If you feel ambitious, modify your program so that the computer makes the moves for one of the players automatically. Also, allow the player to specify whether he or she wants to go first or second. If you feel exceptionally ambitious, develop a program that will play three-dimensional Tic-Tac-Toe on a 4-by-4-by-4

2 Answers  


what is the diffrence between occur 0 and occur 10 in ABAP.

0 Answers  


What is the purpose of <Trigger> element of <updatePanel> in Ajax

0 Answers  


how we can connect applet with database?

1 Answers  


What is abstract Method i want the exact definition and is there any possibility to declare class as abstract without any abstract methods in that class?If it is possible then tell me why and how?

0 Answers  


Delta 5 weight scale not connect with oracle application what i can do?

0 Answers  


Categories