Hoy mam jeden a dost velkz problem.....
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std;
int Opakovani;
int Uloz;
int Pocet=0;
int main ()
{
cout << "Dobry den" << endl;
cout << " Vitam Vas v tomto programu" << endl;
cout << " Program ma jen jedno pravidlo:" << endl;
cout <<" misto mezerniku' ' pouzivejte prosim podtrzitko'_'";
cout << endl;
cout << endl;
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 krestni jmeno: ";
cin >> Jmeno; //Hotovo 100%
//------------------------------------------------------------------------------------------------------------
char Prijmeni[15];
cout << "Zadejte prijmeni: ";
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.Nevlastnim nic): ";
cin >> Zarizeni;
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 << "Vase jmeno: " << Jmeno << " " << Prijmeni << "." << endl;
fout << endl;
fout << "Vek: " << Vek << " let." << endl;
fout << endl;
fout << "Z/Ze: " << Mesto << "." << endl;
fout << endl;
fout << "Vlastnite PC nebo Notebook?: Nevlastni ani PC ani Notebook." << endl;
fout.close();
cout << " Zaznam byl ulozen" << endl;
}
else
{
fout.close();
remove(Jmeno_soubor);
}
cout << "Chcete zpracovat dalsi zaznam(1.Ano, 2.Ne)?: ";
cin >> Opakovani;
if(Opakovani==1)
{
system("CLS");
Pocet++;
continue;
}
else continue;
} //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(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;
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 << " 1. Office XP\n 2. Office 2003\n 3. Windows 2008\n: ";
cin >> MO;
} //Jeste neni zapis
//------------------------------------------------------------------------------------------------------------
int Pracuji;
char Vydelek[20];
char Prace[20];
cout << "Vydelavate pomoci PC ci Notebooku(1.Ano, 2.Ne)?: ";
cin >> Pracuji;
if(Pracuji==1)
{
cout << " Jakou praci delate?: ";
cin >> Prace;
cout << " Jaky je Vas prumerny vydelek?: ";
cin >> Vydelek;
}
else
cout << endl; //Jeste neni zapis
//------------------------------------------------------------------------------------------------------------
int Hodnoceni;
cout << "Jak by jste ohodnotily tento dotaznik?(Jako ve skole - 1=Vyborny...): ";
cin >> Hodnoceni;
cout << endl; //Hotovo, Jen chyby zapis do souboru
//------------------------------------------------------------------------------------------------------------
cout << "Chcete zaznam ulozit(1.Ano, 2.Ne)?: ";
cin >> Uloz;
if(Uloz==1)
{
fout << "Vase jmeno: " << Jmeno << " " << Prijmeni << "." << endl;
fout << endl;
fout << "Vek: " << Vek << " let." << endl;
fout << endl;
fout << "Z/Ze: " << Mesto << "." << endl;
fout << endl;
if(Zarizeni==1) fout << "Vlastnite PC nebo Notebook?: Vlastni PC." << endl;
if(Zarizeni==2) fout << "Vlastnite PC nebo Notebook?: Vlastni Notebook." << endl;
if(Zarizeni==3)
{
fout << "Vlastnite PC nebo Notebook?: Vlastni oboji." << endl;
if(Pouziti==1) fout << " Vice pouziva PC." << endl;
if(Pouziti==2) fout << " Vice pouziva Notebook." << endl;
}
fout << endl;
fout << "Kolik travite hodin u PC nebo Notebooku denne?: " << Cas << " hod." << endl;
fout << endl;
if(OS==1)
{
if(Win==1) fout << "Jaky mate OS?: Ma Microsoft 95." << endl;
if(Win==2) fout << "Jaky mate OS?: Ma Microsoft 98." << endl;
if(Win==3) fout << "Jaky mate OS?: Ma Microsoft 2000." << endl;
if(Win==4) fout << "Jaky mate OS?: Ma Microsoft XP." << endl;
if(Win==5) fout << "Jaky mate OS?: Ma Microsoft Vista." << endl;
if(Win==6) fout << "Jaky mate OS?: Ma Microsoft 7." << endl;
}
if(OS==2) fout << "Jaky mate OS?: Ma Linux." << endl;
if(OS==3) fout << "Jaky jiny OS mate?: " << Jiny << "." << endl;
fout << endl;
if(Net==1)
{
fout << "Ma pripojeni na internet." << endl;
if(Vyuziti==1) fout << " Internet vubec nevyuziva." << endl;
if(Vyuziti==2) fout << " Internet moc nevyuziva." << endl;
if(Vyuziti==3) fout << " Je na internetu denne." << endl;
fout << " Internet ma od: " << Poskytovatel << "." << endl;
fout << " Rychlost pripojeni: " << Rychlost << "." << endl;
fout << " Jak jste spokojen(a) s pripojenim?: " << Spokojenost << "." << endl;
}
if(Net==2) fout << "Nema pripojeni na internet." << endl;
fout << endl;
if(Kancelar==1)
{
if(MO==1) fout << "Pouziva Microsoft Office XP." << endl;
if(MO==2) fout << "Pouziva Microsoft Office 2003." << endl;
if(MO==3) fout << "Pouziva Microsoft Office 2007." << endl;
}
if(Kancelar==2) fout << "Pouziva OpenOffice." << endl;
fout << endl;
if(Pracuji==1)
{
fout << "Vydelava pomoci PC nebo Notebooku." << endl;
fout << " Dela:" << Prace << "." << endl;
fout << " Prumerne vydela: " << Vydelek << "Kc." << endl;
}
if(Pracuji==2) fout << "Nevydelava pomoci PC nebo Notebooku" << endl;
fout << endl;
fout << "Hodnoceni dotazniku: " << Hodnoceni << endl;
fout.close();
cout << " Zaznam byl ulozen" << endl;
}
else
{
fout.close();
remove(Jmeno_soubor);
}
cout << "Chcete zpracovat dalsi zaznam(1.Ano, 2.Ne)?: ";
cin >> Opakovani;
if(Opakovani==1)
{
system("CLS");
Pocet++;
}
}
while(Opakovani!=2);
cout << endl;
cout << "Dnes jste zpracovaly celkem: " << Pocet << " dotazniku." << endl;
cout << endl;
cout << "Preji prijemny den." << endl;
getchar();
}
dát vse do funkci..... a nejde mi to, kdyz dam treba
char Jmeno[15];
cout << "Zadejte krestni jmeno: ";
cin >> Jmeno; //Hotovo 100%
do funkce tak mi to nejede... poradi mi nekdo? jakym zpusobem to mam udelat? diky moc