Advertisement
Harse

Untitled

Apr 24th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. #include<string>
  4. using namespace std;
  5.  
  6.  
  7.  
  8.  
  9.  
  10. int main(){
  11.  
  12. ofstream myfile;
  13. myfile.open ("File.txt");
  14. cout<<"Enter a string the limit is 80 characters"<<endl;
  15. string text;
  16. cin>>text;
  17. if(text.size()<=80){
  18. myfile <<text;
  19. myfile<<"End";
  20. }
  21. else{
  22. for(int i=0;i<80;i++){
  23. myfile<<text.at(i);
  24. myfile<<"End";
  25. }
  26. }
  27. myfile.close();
  28.  
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement