Hi, I started another thread but I think people misunderstood what I was asking and then it just turned into an argument that had little to do with my original question, quite amusing but not that helpful.
What I want to do is run the program and when the user signals the end of the program I want to display Thank You bye for a second or so then the program shuts down (exits itself) I have everything else down except the shutting down process, Please could someone Help me.
Here is the code:
The for loops don't have code missing, I am a newbie so that is the only way I could think to get a delay before quitting the program.Code:/*Program to work out the price of any quantity of products at any price, plus any rate of vat*/ #include <iostream.h> #include <conio.h> #include <stdlib.h> #include <string.h> int main(void) { //Declare the variables float cost, quant, price, vat, full, temp; int length, count; char yesno, vats[10]; while (yesno != 'n' && yesno != 'N') { //Get info from user clrscr(); cout<<"Please enter the price of the product: "; cin>>cost; cout<<"\n\n"; cout<<"Please enter the quantity of products: "; cin>>quant; cout<<"\n\n"; cout<<"Please enter your rate of vat: "; cin.ignore(); cin.getline(vats, 10); length=strlen(vats); if (length == 0) { temp = 17.5; } else { temp=atof(vats); } cout<<"\n\n\n"; //do the calculation temp= temp / 100; price= cost * quant; vat= cost * quant * temp; full= price + vat; //give the answer cout<<"The price of "<<quant<<" product(s) at "<<cost<<" each = £"<<price<<"\n\n" "The vat = £"<<vat<<"\n\n" "Price plus vat = £"<<full<<"\n\n"; cout<<"Would you like to use the program again? "; cin>>yesno; cout<<"\n"; } clrscr(); cout<<"\n\n\n\n\n\n\n\n\n\nThankyou Bye!"; for (int i=0; i<=5000; i++) { for (int j=0; j<=2500; j++) { } } return 0; }
Thanks.



LinkBack URL
About LinkBacks


