#include <iostream>
using namespace std;
voidLevel_1();
voidLevel_2();
int main()
{
cout<<"Select the level(1 or 2):"<<endl;
int iLevel=0;
cin>>iLevel;
while(1)
{
if(iLevel==1 ||iLevel==0)
{
Level_1();
}
if(iLevel==2)
{
Level_2();
}
cout<<"Tocontinue, enter the: y/Y"<<endl;
char qCh;
cin>>qCh;
if(qCh=='y' || qCh=='Y')
{
break;
}
}
return 0;
}
void Level_1()
{
cout<<"Enter 5 evennumbers:"<<endl;
int num=0;
for(inti=0; i<5;)
{
cin>>num;
if(num%2==0)
{
i++;
}
else
{
cout<<"Wrong, try again!"<<endl;
}
}
cout<<endl<<endl<<"===================+Congratulations,you won!+===================="<<endl<<endl;
}
void Level_2()
{
cout<<"Enter the 10 oddnumbers:"<<endl;
int num=0;
for(inti=0; i<10;)
{
cin>>num;
if(num%2==1)
{
i++;
}
else
{
cout<<"Wrong, try again!"<<endl;
}
}
cout<<endl<<endl<<"===================+Congratulations,you won!+===================="<<endl<<endl;
}
Comments
Leave a comment