Εδώ είναι να πρόγραμμα ,γραμμένο σε C++ ,όπου ο χρήστης εισάγει δυο ομάδες και το πρόγραμμα αποφασίζει ποιά απο τις δύο θα κερδίσει.
Η νικήτρια ομάδα, προκύπτει προφανώς απο τυχαία διαδικασία...
#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
int main()
{
string om1, om2;
int i,r,o;
for (o=0;o<=3;o++)
{
cout<<"dwse 1h omada: "<<endl;
cin>>om1;
cout<<"dwse 2h omada: "<<endl;
cin>>om2;
srand(time(NULL));
r=rand()%3+1;
cout<<"r: "<<r<<endl;
cout<<"\n\n";
if(r==1)
cout<<"nikhse h prwth omada : "<<om1<<endl;
else if(r==2)
cout<<"nikhse h deuterh omada : "<<om2<<endl;
else
cout<<"isopalia"<<endl;
system("pause");
}
}
Η νικήτρια ομάδα, προκύπτει προφανώς απο τυχαία διαδικασία...
#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
int main()
{
string om1, om2;
int i,r,o;
for (o=0;o<=3;o++)
{
cout<<"dwse 1h omada: "<<endl;
cin>>om1;
cout<<"dwse 2h omada: "<<endl;
cin>>om2;
srand(time(NULL));
r=rand()%3+1;
cout<<"r: "<<r<<endl;
cout<<"\n\n";
if(r==1)
cout<<"nikhse h prwth omada : "<<om1<<endl;
else if(r==2)
cout<<"nikhse h deuterh omada : "<<om2<<endl;
else
cout<<"isopalia"<<endl;
system("pause");
}
}
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου