Sep 23, 2012 at 10:32pm UTC
So i'm assuming a variable isnt labled?
I don't know if it's the right command.
I need that command to translate everything to the right.
Help?
// Monthly Sales Tax
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
using namespace std;
int main ()
{
double year, total, sales, ctax, stax, tTax, Ctax, Stax;
char month[13];
Ctax = 0.02;
Stax = 0.06;
ctax = (total)*(Ctax);
stax = (total)*(Stax);
tTax = (stax)+(ctax);
sales = (total)-(tTax);
cout<< "What month is it ? ";
cin >> month;
cout<< "What year is it ? ";
cin>> year;
cout<< "How much was collected in total ? ";
cin >> total;
cout<< "Month: " << month << endl;
cout<< "-------------------------- \n\n";
cout<< "Total Colleced: ";
cout<< right << " $ "<< setprecision[2] << total << endl;
cout<< "Sales: ";
cout<< right << " $ "<< setprecision[2] << sales << endl;
cout<< "Count Sales Tax: ";
cout<< right << " $ " << setprecision[2] <<ctax << endl;
cout<< "State Sales Tax: ";
cout<< right << " $ " << setprecision[2] << stax << endl;
cout<< "Total Sales Tax: ";
cout<< right << " $ " << setprecision[2]<< tTax << endl;
cin.get ();
return 0;
}
Sep 23, 2012 at 11:18pm UTC
These statements have no sense because variable total is uninitialized.
ctax = (total)*(Ctax);
stax = (total)*(Stax);
tTax = (stax)+(ctax);
sales = (total)-(tTax);
The expression setprecision[2] shall use parentheses.
Last edited on Sep 23, 2012 at 11:18pm UTC
Sep 23, 2012 at 11:20pm UTC
But those variables dont make sense until you input the number.. so enter all these things then ?
Last edited on Sep 23, 2012 at 11:22pm UTC
Sep 23, 2012 at 11:26pm UTC
I think I said clear enough what is wrong with your program.
Last edited on Sep 23, 2012 at 11:28pm UTC
Sep 23, 2012 at 11:28pm UTC
I'm not that bright . This is the beginners section as well. How do I initialize the variable then
Sep 23, 2012 at 11:31pm UTC
I did not say that variables need initialization. I said that those statements have no sense because variable total is unitialized . Do you understand what are you doing?!!!
Last edited on Sep 23, 2012 at 11:31pm UTC
Sep 23, 2012 at 11:34pm UTC
... How do you initialize total then..
Sep 23, 2012 at 11:35pm UTC
One more do you understand what are you doing in these statements?!!!
Well say me what will be the value of ctax after this statement?
ctax = (total)*(Ctax);
Last edited on Sep 23, 2012 at 11:36pm UTC
Sep 23, 2012 at 11:37pm UTC
No not completely. I'm trying to figure why the other things do not make sense since I have to input total after .
Sep 23, 2012 at 11:40pm UTC
The value will be unknown because total is not enter. So does that mean I have to enter the functions using total after the input for total?
Last edited on Sep 23, 2012 at 11:42pm UTC