loop and counter help

so i need help creating a loop once the use get asked to in put for gas and once the loop starts over the counter would then re ask the usurer for gas or to speed up or slow down.
//============================================================================
// Name : car.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include<algorithm>
#include<string>

using namespace std;

const int SIZE = 5;
int gas;
int main() {
string intArray[SIZE]={"1st Gear","2nd Gear","3rd gear","4th Gear","Reverse"};

sort(intArray, intArray + SIZE);
cout<< "These are your gear in your gear box\n"
"please enter one to speed up and shift gears\n"
"or push zero to slow down and down shift\n";
cout<<"\n"
"\n"
"\n"
"Enter 1 or 0 :\n";

cin>>gas;
for (int i =0; i != 1; ++i){
if(gas ==1){
cout<<intArray[0]<< " ";
}
else if (gas==2){
cout<<intArray[1]<< " ";
}
else if (gas == 3){
cout<< intArray[2]<< " ";
}
else if(gas ==4){
cout<<intArray[3]<<" ";
}
else if(gas ==0){
cout<<intArray[4]<<" ";
}
else{
cout<<"You blew the engine!!\n";
}
}
return 0;
}
Topic archived. No new replies allowed.