hello im writing a if statment for class and i cant get the program to terminate if the user goes to the else statement it still prints out the other cout's here is my program your supposed to enter in a id number then the crn of the class u want to take ( for example 4587) but when u enter a wrong crn number such as 123 it displays the "course not found" but still prints the rest of the program but i want it to terminate there.
#include<iostream>
using namespace std;
#define ch1 120.25
#define healthid 35.00
int main()
{
int id;
double credit,payment,totalpay;
int crn;
string prefix;
cout <<fixed;
cout .precision (2);
cout <<"Enter student ID:V" ;
cin >>id ;
cout <<"Enter CRN for first course:" ;
cin>>crn;
if (crn == 4587)
{prefix = "MAT 236";
credit = 4;
}
else if (crn == 4599)
{prefix = "COP 220";
credit = 3;
}
else if (crn == 8997)
{prefix = "GOL 124";
credit = 1;
}
else if (crn == 9696)
{prefix = "COP 100";
credit = 5;
}
else if (crn == 4580)
{prefix = "MAT 230";
credit = 3;
}
else if (crn == 4581)
{prefix = "MAT 231";
credit = 4;
}
else if (crn == 4582)
{prefix = "MAT 232";
credit = 2;
}
else if (crn == 4583)
{prefix = "MAT 233";
credit = 2;
}
else if (crn == 3587)
{prefix = "MAT 256";
credit = 4;
}
else if (crn == 4519)
{prefix = "COP 420";
credit = 3;
}
else
{cout<<"Course not found try again!!\n\n";
}
payment = credit * ch1;
totalpay = payment + healthid ;
cout <<"VALENCIA COMMUNITY COLLEGE\n" ;
cout <<"ORLANDO,FL 10101\n" ;
cout <<"**************************\n\n" ;
cout <<"Fee Invoice Prepared for Student: V" <<id <<"\n\n" ;
cout <<"1 Credit Hour= $120.25\n\n" ;
cout <<"CRN\tPrefix\t Credit Hours\n" ;
cout <<crn <<"\t" <<prefix <<"\t " <<credit <<"\t$"<<payment <<"\n\n" ;
cout <<"\tHealth & ID fees $" <<healthid <<"\n\n" ;
cout <<"-----------------------------\n\n" ;
cout <<"\tTotal Payments: $" <<totalpay <<"\n" ;
system ("pause") ;
}