#include <iostream>
#include <cstdlib>
#include <stdio.h>
using namespace std;
int wybor_1,wybor_2,wybor_3,zycie=1,obrona=1,atak=1,lvl=1,xp=1;
void zapisz()
{
FILE *save=fopen("save.sav","w");
fprintf(save,"%02d , %02d , %02d , %02d , %05d",zycie,obrona,atak,lvl,xp);
fclose(save);
}
void wczytaj()
{
FILE *save=fopen("save.sav","r");
fprintf(save,"%02d , %02d , %02d , %02d , %05d",&zycie,&obrona,&atak,&lvl,&xp);
fclose(save);
}
int main()
{
system("title ---WALKA---");
//menu
while(true)
{
system("cls");
cout<<"________"<<endl;
cout<<"WALKA"<<endl;
cout<<"________"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"________"<<endl;
cout<<"1) Graj"<<endl;
cout<<"________"<<endl;
cout<<"2) Opcje"<<endl;
cout<<"________"<<endl;
cout<<"3) Wyjdz"<<endl;
cout<<"________"<<endl;
//graj
if (wybor_1==1)
{
system("cls");
cout<<"__________"<<endl;
cout<<"GRAJ"<<endl;
cout<<"__________"<<endl;
cout<<"1) Od nowa"<<endl;
cout<<"2) Wczytaj"<<endl;
cout<<"__________"<<endl;
cout<<"3) Wroc"<<endl;
cout<<"__________"<<endl;
if (!(cin>>wybor_3))
{
cerr<<"To nie jest liczba!";
break;
}
if(wybor_3==3)
{
}
system("cls");
}
if (!(cin>>wybor_1))
{
cerr<<"To nie jest liczba!";
break;
}
//wyjscie
if(wybor_1==3)
{
exit(0);
system("cls");
}
//opcje
if(wybor_1==2)
{
system("cls");
cout<<"________________"<<endl;
cout<<"OPCJE"<<endl;
cout<<"________________"<<endl;
cout<<"Zmien kolor tla:"<<endl;
cout<<"1) Czarny"<<endl;
cout<<"2) Niebieski"<<endl;
cout<<"3) Zielony"<<endl;
cout<<"4) Blekitny"<<endl;
cout<<"5) Czerwony"<<endl;
cout<<"6) Purpurowy"<<endl;
cout<<"7) Zolty"<<endl;
cout<<"8) Szary"<<endl;
cout<<"________________"<<endl;
cout<<"9) wroc"<<endl;
cout<<"________________"<<endl;
if (!(cin>>wybor_2))
{
cerr<<"To nie jest liczba!";
break;
}
if(wybor_2==1)
{
system("color 07");
}
if(wybor_2==2)
{
system("color 17");
}
if(wybor_2==3)
{
system("color 27");
}
if(wybor_2==4)
{
system("color 37");
}
if(wybor_2==5)
{
system("color 47");
}
if(wybor_2==6)
{
system("color 57");
}
if(wybor_2==7)
{
system("color 67");
}
if(wybor_2==8)
{
system("color 87");
}
if(wybor_2==9)
{
}
system("cls");
}
}
return 0;
}
Mam problem z tym w komentarzu "graj" jak daje 3 to powinno dawać: wyczyszczenie ekranu i że mam zapętlone powinno mi dać "menu" ale mam problem z tym wyczyszczeniem, ponieważ mi wyczyszcza ale nie włącza mi się "menu" jest pusto ale potem jak wpisze się cyfrę to wyskakuje to menu nie wiem co mam zrobić by tak nie było pomocy! I jeszcze jedno tego "1) graj od nowa" i "2) wczytaj" to jeszcze nie mam zrobionego.