[c++] help, cant get this to work
hi im trying to learn Cpp and i was doing stuff from the book
and i got stuck at this
Code:
#include <iostream>
int main() {
// Declare the variables
unsigned short quantity;
float price; // float tell it what to rember
float taxRate;
// Assign values
quantity = 3;
price = 19.95; //linked to "float pirce"
taxRate = 0.05; // linked to "float taxRate"
//tell them the name of the app and what it does
std::cout << "widget cost calculator\n";
// output
std::cout << "the cost of purchasing "
<< quantity <<" widget(s) at price of $" << price
<< ", with tax, comes to $";
// Adjust the formatting
std::cout.setf(std::ios_base::fixed);
std::cout.setf(std::iso_base::showpoint);
std::cout.precision(2);
//calculation
std::cout << ( (quantity * price) + ((quantity * price) * taxRate))<< ".\n";
std::cout << "PRESS ENTER!/n";
std::cin.get();
return 0;
}
for some reson it says
Code:
std::cout.setf(std::iso_base::showpoint);
Quote:
25 C:\Dev-Cpp\chapter 2.cpp `std::iso_base' has not been declared
is my problem...but i have know idear why...(dumb book doesnt say what it does...)
book writer/s: Larry Ullman, Andreas Signer
Re: [c++] help, cant get this to work
/bump ...doesnt any one know Cpp?
Re: [c++] help, cant get this to work
You put iso_base instead of ios_base. It's a typo. Learn to read error messages and check your code better.
Re: [c++] help, cant get this to work
Re: [c++] help, cant get this to work
need headers and namespace
#include <iostream>
using namespace std;