Advertisement
Guest User

Untitled

a guest
Jan 26th, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>  
  3. #include <fstream>
  4.  
  5. using namespace std;
  6. int main()
  7. {
  8. char ime[50];
  9. char prezime[50];
  10. char podatci[100];
  11. char zivi[50];
  12. char web[50];
  13. char godine[50];
  14. cout<<"Program sa spremanjem podataka by LockeR"<< endl<< endl;
  15. cout<<"Ukucajte vase ime: ";
  16. cin.getline ( ime, 50 );
  17. cout<<"Ok!Vase ime je "<< ime  <<"!"<< endl<< endl;
  18. cout<<"Ukucajte vase prezime: ";
  19. cin.getline ( prezime, 50 );
  20. cout<<"Ok!Vase prezime je "<< prezime  <<"!"<< endl<< endl;
  21. cout<<"Ukucajte mjesto zivljenja: ";
  22. cin.getline ( zivi, 50);
  23. cout<<"Ok!Zivis u "<< zivi  <<"!"<< endl<< endl;
  24. cout<<"Godine: ";
  25. cin.getline ( godine, 50);
  26. cout<<"Ok!Imas "<< godine  <<" godina!"<< endl<< endl;
  27. cout<<"Ukucajte vas omiljeni web: ";
  28. cin.getline ( web, 50);
  29. cout<<"Ok!Vas omiljeni web je "<< web  <<"!"<< endl<< endl;
  30. podatci[0] = '\0';          
  31. strcat ( podatci, ime );    
  32. strcat ( podatci, " - Ime\n" );      
  33. strcat ( podatci, prezime );
  34. strcat ( podatci, " - Prezime\n" );
  35. strcat ( podatci, zivi );
  36. strcat ( podatci, " - Mjesto zivljenja\n" );
  37. strcat ( podatci, godine );
  38. strcat ( podatci, " - Godine\n" );
  39. strcat ( podatci, web );
  40. strcat ( podatci, " - Omiljeni Web" );
  41. cout<<"Podatci:\n "<< podatci <<"\n"<< endl<< endl;
  42. cout<<"Podatci su uspjesno spremljeni u Podatci.txt";
  43. cin.get();
  44. ofstream podatke ("Podatci.txt");
  45. podatke <<"Ime: "<< ime  <<"\n\n";
  46. podatke <<"Prezime: "<< prezime  <<"\n\n";
  47. podatke <<"Mjesto zivljenja: "<< zivi  <<"\n\n";
  48. podatke <<"Godine: "<< godine  <<"\n\n";
  49. podatke <<"Omiljeni web: "<< web  <<"\n\n";
  50. return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement