For class I am supposed to write a program to calcualte discounts...
Using a "for" loop have the program calculate the actual perchase price after ther discount for the nest $20 in $0.50 increments...
Example
Starting Price:
Percent discount:
Price -Diss New $
$1.00 $0.20 $0.80
$1.50 $0.30 $1.20
$1.00 $0.40 $1.60
........
$21.00 $4.20 $16.80
Now here is my code... I am useing VS.NET 2005 Beta 1 and in wont let me compile with "std::" infront of the i/o streams... Why do I need them?
#include <iostream>
int main() {
// Variables
float startprice;
float discount;
float h;
// info
std::cout << "Enter the Starting Price: t$";
std::cin >> startprice;
std::cout << "Percent Discount: t";
std::cin >> discount;
//For loops and stuff
for(h = startprice; h <= (20 + startprice); (h+.5)) {
std::cout << "Pricet-DisctNew $";
std::cout << h << "t" << h/discount << "t" << h-(h / discount);
}
return 0;
}
Aqua-Soft Forums