To crAzY^ : tak vypada cely program......
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std;
int Opakovani;
int Uloz;
int main ()
{
do{
char Jmeno_soubor[20];
char typ[] = ".txt";
cout << "Zadejte cele jmeno(_ = mezera): ";
cin >> Jmeno_soubor;
strcat(Jmeno_soubor,typ);
ofstream fout(Jmeno_soubor); //Hotovo 100%
//------------------------------------------------------------------------------------------------------------
char Jmeno[15];
cout << "Zadejte kresni jmeno: ";
cin >> Jmeno; //Hotovo 100%
//------------------------------------------------------------------------------------------------------------
char Prijmeni[15];
cout << "Zadejte prijmen: ";
cin >> Prijmeni; //Hotovo 100%
//------------------------------------------------------------------------------------------------------------
int Vek;
cout << "Vek: ";
cin >> Vek; //Hotovo 100%
//------------------------------------------------------------------------------------------------------------
char Mesto[15];
cout << "Odkud jste?: ";
cin >> Mesto; //Hotovo 100%
//------------------------------------------------------------------------------------------------------------
int Zarizeni;
int Pouziti;
cout << "Vlastnite PC nebo Notebook?\n (1.PC, 2.Notebook, 3.Vlatnim oboji, 4.Nevlastní nic): ";
cin >> Zarizeni;
if(Zarizeni==1){cout << endl;}
if(Zarizeni==2){cout << endl;}
if(Zarizeni==3)
{
cout << "Co vice pouzivate(1.PC, 2.Notebook)"; cin >> Pouziti;
}
if(Zarizeni==4)
{
cout << "Chcete zaznam ulozit(1.Ano, 2.Ne)?: ";
cin >> Uloz;
if(Uloz==1)
{
fout << Jmeno << " " << Prijmeni << endl;
fout << Vek << endl;
fout << Mesto << endl;
fout << "Vlastnite PC nebo Notebook?: Nevlastni ani PC ani Notebook" << endl;
fout.close();
}
else
{
fout.close();
remove(Jmeno_soubor);
}
cout << "Chete zpracovat dalsi zaznam(1.Ano, 2.Ne)?: ";
cin >> Opakovani;
if(Opakovani==1) system("CLS"); else;
} //Problem s ukoncenim.....nezacne to od zacatku...
//------------------------------------------------------------------------------------------------------------
float Cas;
cout << "Kolik hodin denne travite na svem PC ci Notebooku?: ";
cin >> Cas; //Hotovo, Jen chyby zapis do souboru
//------------------------------------------------------------------------------------------------------------
int OS;
int Win;
char Jiny[20];
cout << "Jaky mate operacni system?(1.Windows, 2.Linux, 3.Jiny): ";
cin >> OS;
if(OS==1)
{
cout <<" 1. Windows 95\n 2. Windows 98\n 3. Windows 2000\n 4. Windows XP\n 5. Windows Vista\n 6. Windows 7\n: ";
cin >> Win;
if(Win==1){"-----------------";}
if(Win==2){"-----------------";}
if(Win==3){"-----------------";}
if(Win==4){"-----------------";}
if(Win==5){"-----------------";}
if(Win==6){"-----------------";}
}
if(OS==2){cout << "Mate Linux" << endl;}
if(OS==3)
{
cout << "Jaky?: ";
cin >> Jiny;
}
//Jeste neni zapis
//------------------------------------------------------------------------------------------------------------
int Net;
int Vyuziti;
char Poskytovatel[20];
char Rychlost[15];
char Spokojenost[30];
cout << "Mate pripojeni na internet(1.Ano, 2.Ne)?: ";
cin >> Net;
if(Net==1)
{
cout << "Jak casto pouzivate internet(1.Vubec, 2. Moc ne, 3. Denne?): ";
cin >> Vyuziti;
if(Vyuziti==1){"------------------------------------------------------------";}
if(Vyuziti==2){"------------------------------------------------------------";}
if(Vyuziti==3){"------------------------------------------------------------";}
cout << "Od jakeho poskytovatele?: ";
cin >> Poskytovatel;
cout << "Jakou mate rychlost pripojeni?: ";
cin >> Rychlost;
cout << "Jak jste s pripojenim spokojen(a)?: ";
cin >> Spokojenost;
}
if(Net==2)
cout << " " << endl; //Jeste neni zapis
//------------------------------------------------------------------------------------------------------------
int Kancelar;
int MO;
cout << "Jake pouzivate kancelarske nastroje?(1.Microsoft Office, 2.OpenOffice): ";
cin >> Kancelar;
if(Kancelar==1)
{
cout << " Microsoft?(1.Office XP, 2.Office 2003, 3.Office 2007): ";
cin >> MO;
if(MO==1){"--------------";}
if(MO==2){"--------------";}
if(MO==3){"--------------";}
}
else; //Jeste neni zapis
//------------------------------------------------------------------------------------------------------------
int Pracuji;
int Vydelek;
char Pouzivas[10];
char Prace[20];
cout << "Vydelavate pomoci PC ci Notebooku(1.Ano, 2.Ne)?: ";
cin >> Pracuji;
if(Pracuji==1)
{
cout << "Pouzivate PC ci Notebook ke sve praci?: ";
cin >> Pouzivas;
cout << "Jakou praci delate?: ";
cin >> Prace;
cout << "Jaky je Vas prumerny vydelek?: ";
cin >> Vydelek;
}
else; //Jeste neni zapis
//------------------------------------------------------------------------------------------------------------
int Hodnoceni;
cout << "Jakou by jste ohodnotily tento dotaznik?(Jako ve skole - 1=Vyborny...): ";
cin >> Hodnoceni; //Hotovo, Jen chyby zapis do souboru
//------------------------------------------------------------------------------------------------------------
cout << "Chcete zaznam ulozit(1.Ano, 2.Ne)?: ";
cin >> Uloz;
if(Uloz==1)
{
fout << Jmeno << " " << Prijmeni << endl;
fout << Vek << endl;
fout << Mesto << endl;
if(Zarizeni==1) fout << "Vlastnite PC nebo Notebook?: PC" << endl;
if(Zarizeni==2) fout << "Vlastnite PC nebo Notebook?: Notebook" << endl;
if(Zarizeni==3) fout << "Vlastnite PC nebo Notebook?: Vlastni oboji" << endl; //Podotazka..............
fout << Cas << " hod" << endl;
fout << OS << endl;
fout << Net << endl;
fout << Kancelar << endl;
fout << Prace << endl;
fout << Hodnoceni << endl;
fout.close();
}
else
{
fout.close();
remove(Jmeno_soubor);
}
cout << "Chete zpracovat dalsi zaznam(1.Ano, 2.Ne)?: ";
cin >> Opakovani;
if(Opakovani==1) system("CLS");
}
while(Opakovani!=2);
}
Tak jako fakt nevim jak to udelat...... aby mi to slo opet odzacatku....