Thread: C++ Help
View Single Post
Old 09-15-2005, 04:28 PM   #9
chickendude
Away from Computer
FFR Simfile AuthorFFR Veteran
 
chickendude's Avatar
 
Join Date: Sep 2003
Location: Massachusetts
Age: 33
Posts: 1,901
Send a message via AIM to chickendude
Default RE: C++ Help

I can do C, but I'm guessing its mostly the same except for minor syntactical stuff <_<

Code:
main()
{
 float oprice, taxrate, markup,fprice,sprice,tax;

 printf("print the original price, tax rate percentage, and markup percentage")
 scanf("%f %f %f",&oprice,&taxrate,&markup);

 sprice = oprice * (1 + (markup/100) );
 taxprice = sprice * (1 + taxrate/100);
 fprice = sprice + taxprice;

 printf("original price is %f \n markup is %f \n taxrate is %f \n",oprice,markup,taxrate")
 printf("store price is %f \n sales tax is %f \n final price is %f\n",sprice,tax,fprice");
}
now just change the printfs into couts and scanf into a cin and you win
I don't know the syntax for couts and cin >_<
would someone like to tell me
Is it just the same but with << >> instead of () ?

EDIT:
PS, in C to go from string to int its
stoi(insertstringhere)
and you have to #include <stdlib.h>
and stof for string to float
ftoi, itof, they're all there <_< itos ftos <_<
__________________
chickendude is offline   Reply With Quote