What I want to do is read a whole paragraph of text from a custom file. How would I do this without doing something silly like this?

while(someFile >> word1 >> word2 >> word3){
    //etc.
}

I need to be able to read 3 numbers for todays date, then read a whole paragraph, then another whole paragraph, and then repeat it.

Well you could setup something like this :

ifstream qwer ("p.txt");
Int number;
String paragraph;
qwer>>number;
getline(paragraph, qwer); // repeat for each line of paragraph with amend on or with a different  variable ll

The advantage of using amend is that you could just send it throug a loop instead of typeing it for each line.

Well you could setup something like this :

ifstream qwer ("p.txt");
Int number;
String paragraph;
qwer>>number;
getline(paragraph, qwer); // repeat for each line of paragraph with amend on or with a different  variable ll

The advantage of using amend is that you could just send it throug a loop instead of typeing it for each line.

How would I use that in the while loop though?

Well you could increment a number each loop (variable++) and when it reaches a point (while(variable!=5)) it breaks out of the loop.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.