Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <fstream>
- using namespace std;
- int main()
- {
- char ime[50];
- char prezime[50];
- char podatci[100];
- char zivi[50];
- char web[50];
- char godine[50];
- cout<<"Program sa spremanjem podataka by LockeR"<< endl<< endl;
- cout<<"Ukucajte vase ime: ";
- cin.getline ( ime, 50 );
- cout<<"Ok!Vase ime je "<< ime <<"!"<< endl<< endl;
- cout<<"Ukucajte vase prezime: ";
- cin.getline ( prezime, 50 );
- cout<<"Ok!Vase prezime je "<< prezime <<"!"<< endl<< endl;
- cout<<"Ukucajte mjesto zivljenja: ";
- cin.getline ( zivi, 50);
- cout<<"Ok!Zivis u "<< zivi <<"!"<< endl<< endl;
- cout<<"Godine: ";
- cin.getline ( godine, 50);
- cout<<"Ok!Imas "<< godine <<" godina!"<< endl<< endl;
- cout<<"Ukucajte vas omiljeni web: ";
- cin.getline ( web, 50);
- cout<<"Ok!Vas omiljeni web je "<< web <<"!"<< endl<< endl;
- podatci[0] = '\0';
- strcat ( podatci, ime );
- strcat ( podatci, " - Ime\n" );
- strcat ( podatci, prezime );
- strcat ( podatci, " - Prezime\n" );
- strcat ( podatci, zivi );
- strcat ( podatci, " - Mjesto zivljenja\n" );
- strcat ( podatci, godine );
- strcat ( podatci, " - Godine\n" );
- strcat ( podatci, web );
- strcat ( podatci, " - Omiljeni Web" );
- cout<<"Podatci:\n "<< podatci <<"\n"<< endl<< endl;
- cout<<"Podatci su uspjesno spremljeni u Podatci.txt";
- cin.get();
- ofstream podatke ("Podatci.txt");
- podatke <<"Ime: "<< ime <<"\n\n";
- podatke <<"Prezime: "<< prezime <<"\n\n";
- podatke <<"Mjesto zivljenja: "<< zivi <<"\n\n";
- podatke <<"Godine: "<< godine <<"\n\n";
- podatke <<"Omiljeni web: "<< web <<"\n\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement