I made up my own while loop to imitate cruse control on a car but theres just one error that keeps showing up
and no I'm not trying to get anybody to do my homework
here it is!!!
#include <iostream>
using namespace std;
int main()
{
int curent_speed;
int set_speed;
// this loop is to maintain speed on cruse control
cout<<"set cruise control to desired speed"<<endl;
cin>>set_speed;
cin>>curent_speed;
//this is the part where if the car where to incline or decline speed
//do to a hill up or down, the program helps stabilize speed
while (curent_speed < set_speed)
{
cout<<"automobile is now increasing to set speed"<<endl;
curent_speed++;
{
while (curent_speed > set_speed)
{
cout<<"automobile is now decreacing to set speed"<<endl;
curent_speed--;
{
if (curent_speed = set_speed)
cout<<"automobile is maintaining set speed"<<endl;
return 0;
}
// i'm thinking this if statement should go up top but i dont now
//the error Im getting is
//end of file found before left brace
while (current_speed < set_speed)
{
cout<<"speed is currently "<<current_speed<<endl;
current_speed++;
}
while (current_speed > set_speed)
{
cout<<"speed is currently "<<current_speed<<endl;
current_speed--;
}
if (current_speed = set_speed)
cout<<"cruse speed is maintaining at "<<set_speed<<endl;
cout<<endl;
cout<<endl;
the next question I have is where the hell on my keyboard is the key for an or statement
ex. while (a<100 or a>100) i onow its supposed to be 2 lines like II but thats two I's - what the hell do I do?
the next question I have is where the hell on my keyboard is the key for an or statement
ex. while (a<100 or a>100) i onow its supposed to be 2 lines like II but thats two I's - what the hell do I do?