I write this code but I need to get out from while loop when I need ... I tired do it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I write this code but I need to get out from while loop when I need ... I tired do it

void put(char fileName[]){ fil s; fstream file(fileName, ios::out|ios::app); cout<<"\nEnter text and Enter space to get out: "; while (s.txt){ cin.getline(s.txt,255) ; if(s.txt !="n"){ cout<<"The first letter is : "<<s.txt[0]<<endl;} else break; } cout <<endl<< "Programed by : Samira aon"; while (s.txt){ file.write((char *)&s, sizeof(file)); } while((file.read((ch

23rd Oct 2016, 2:43 PM
samira
samira - avatar
3 Answers
+ 1
use the 'break' statement to exit a loop
3rd Nov 2016, 12:24 AM
Carter Marshall
0
how
3rd Nov 2016, 4:26 AM
samira
samira - avatar
0
hi Samira??
5th Dec 2016, 11:33 AM
Umar Asghar
Umar Asghar - avatar