declarations in c++

c++ question. Can anyone help me on this please.

1.a constant that gives the name discount to the value 0.10

2.two variables called amount and unitprice. amount is of type int and initialized to 1.5. unit price is double and is initialized to 12.50

Last edited on
amount is of type int and initialized to 1.5
the types int can't contain numbers with the comma(point) so you can initilized it to 1.0 2.0 but not 1.5:

1.
1
2
/*at start of the code where you type #include <iostream> and others write*/
#define discount 0.10 


2.
1
2
int amount=1;
int amount=2;


Also look there for declarations http://www.cplusplus.com/doc/tutorial/variables/
Topic archived. No new replies allowed.