Hi, I'm really quite new to this so I could do with a bit of elaboration on the last point please, the program I wanted to try it on I have already got stdlib.h here it is:
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++)
{
}
}
exit(0);
return 0;
}
That is my attempt at exit(o);, if it is wrong or I should be doing anything differently please let me know.