Back from the start code??
What code can i use so that the program will return back from the start after it ran.??
back
to the start?
1 2 3 4 5 6 7 8 9 10
|
int main() {
while(true) {
//your code
char again;
std::cout << "again?";
std::cin >> again;
if (again == 'n') break;
}
}
|
i dont know where to sort the codes..would you kindly do it for me??
here is my code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int score=0;
cout<<"Enter Score:"<<endl;
cin>>score;
if(score==100)
{
cout<<"perfect score"<<endl;
}
else if(score>=90 && score<100)
{
cout<<"A"<<endl;
}
else if(score>=80 && score<90)
{
cout<<"B"<<endl;
}
else if(score>=70 && score<80)
{
cout<<"C"<<endl;
}
else if(score>=60 && score<70)
{
cout<<"D"<<endl;
}
else if(score>=0 && score<=59)
{
cout<<"E"<<endl;
}
system("pause");
}
|
Just paste lines 9-39 of your code to line 3 of my code. What's not to know? Don't forget the headers.
thanks sir
Topic archived. No new replies allowed.