#include "stdafx.h"
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <cstdlib>
using namespace std;
int main(int argc, char *argv[])
{
time_t now;
time(&now);
srand(now);
rand();
float choice1,choice2;
choice1=1;
choice2=1;
cout<<"do u want to start?(1:yes,any key:no)"<<endl;
cin>>choice1;
if(choice1==1)
{
while(choice2==1)
{
cout<< "winning number is"<< endl;
for (int i=0; i<7; i++){
cout << (rand() % 40)+1 << endl;
}
cout<< "additional number is"<< endl;
for (int i=0; i<1; i++){
cout << (rand() % 40)+1 << endl;
}
else
{
cout<<"byebye~"<<endl;
}
cout<<"Do u want to continue?(Y:yes,any key:no)"<<endl;
fflush(stdin);
cin>>choice2;
if(choice2==1){
while(choice2==1)
{
cout<< "winning number is"<< endl;
for (int i=0; i<7; i++){
cout << (rand() % 40)+1 << endl;
}
cout<< "additional number is"<< endl;
for (int i=0; i<1; i++){
cout << (rand() % 40)+1 << endl;
}
}
}
}
else
{cout<<"BYEBYE";
}
return 0;
}
哪位高人指点指点,因为我是初学者有if else那个晕了,括号好像用太多了,不知道怎么的了。