K
koolyio
I've been having trouble with my script that uses a do...while loop
and a for loop to calculate subtotals, gst, and totals. I'm making it
for my parents. They own a bar/hotel. And for the caclulations part,
leave tham as is (gst = sub / 107 * 7). Also, I've been having trouble
using the system("PAUSE"); command. My compiler (Dev-C++ 4) says
'implicit declaration of function int system(...)' or something along
those lines. Any help will be greatly appriceiated and give some
credit in the code, thanks!
CODE:
#include <iostream.h>
//define variables
float nums[100];
float sub;
float tot;
float tottax;
float gst;
int howmany;
int i=0;
int a=1;
char x;
//begin application
int main()
{
//title
cout << " w e l c o m e t o . . .\n";
cout << " M y C a l C\n";
//legal stuff
cout << "Welcome to MyCalc. This program is designed to be\n";
cout << "used for commercial buisness and is free under GPL\n";
cout << "Side Note:\n";
cout << " If you get MORE THAN TWO DECIMAL PLACES, use ONLY the\n";
cout << " FIRST TWO decimal places. Thank You!\n\n\n";
cout << "Type Anything And Press Enter to Continue: ";
cin >> x;
cout << "\n\n";
//how many
do
{
if (howmany>100)
{
cout << "Sorry! The number cannot be over a hundred!";
}
cout << "How many numbers will be adding together today?\n";
} while (howmany>100);
for (a ==> howmany)
{
cout << "Enter number #" << a << ": $";
cin >> nums;
sub = nums + sub;
i++;
a++;
}
//total and taxes
gst = sub * 7 / 107;
tot = sub + gst;
//results
cout << "\n\n";
cout << "Your subtotal is: $" << sub << "\n";
cout << "Your GST is: $" << gst << "\n";
cout << "Your total is: $" << tot << "\n";
cout << "Type Anything And Press Enter to Exit: ";
cin >> x;
return 0;
}
Please E-mail the answer to (e-mail address removed)
and a for loop to calculate subtotals, gst, and totals. I'm making it
for my parents. They own a bar/hotel. And for the caclulations part,
leave tham as is (gst = sub / 107 * 7). Also, I've been having trouble
using the system("PAUSE"); command. My compiler (Dev-C++ 4) says
'implicit declaration of function int system(...)' or something along
those lines. Any help will be greatly appriceiated and give some
credit in the code, thanks!
CODE:
#include <iostream.h>
//define variables
float nums[100];
float sub;
float tot;
float tottax;
float gst;
int howmany;
int i=0;
int a=1;
char x;
//begin application
int main()
{
//title
cout << " w e l c o m e t o . . .\n";
cout << " M y C a l C\n";
//legal stuff
cout << "Welcome to MyCalc. This program is designed to be\n";
cout << "used for commercial buisness and is free under GPL\n";
cout << "Side Note:\n";
cout << " If you get MORE THAN TWO DECIMAL PLACES, use ONLY the\n";
cout << " FIRST TWO decimal places. Thank You!\n\n\n";
cout << "Type Anything And Press Enter to Continue: ";
cin >> x;
cout << "\n\n";
//how many
do
{
if (howmany>100)
{
cout << "Sorry! The number cannot be over a hundred!";
}
cout << "How many numbers will be adding together today?\n";
} while (howmany>100);
for (a ==> howmany)
{
cout << "Enter number #" << a << ": $";
cin >> nums;
sub = nums + sub;
i++;
a++;
}
//total and taxes
gst = sub * 7 / 107;
tot = sub + gst;
//results
cout << "\n\n";
cout << "Your subtotal is: $" << sub << "\n";
cout << "Your GST is: $" << gst << "\n";
cout << "Your total is: $" << tot << "\n";
cout << "Type Anything And Press Enter to Exit: ";
cin >> x;
return 0;
}
Please E-mail the answer to (e-mail address removed)