Hi,
can any one tell me that how can i add two different statment constant and show it one answer
for example ,

cout<<"cost of letter ,0.40";
cout<<"GST:0.05";

i want to add values between these two statment o.40+0.05=0.45
i want to perform this function in programme
so can anyone please tell me how can i add these two constant ???
please reply as soon as possible :(

Recommended Answers

All 6 Replies

Do you want to addition of two constant values?

cout << "\nAddition : " << double(0.40+0.05);

You wont get codes here,but we will help you code.
Do this:
1)Take the two strings into a char array(Store those two strings).
2)Traverse through those strings and get the numeric values in that string separated by a "." character and store these values as another string.
3)Find a way to get the numeric value from this string.
4)Add it as adatapost has taught you (Good one there buddy ;)).
5)Print it and you are done.

yes yes yes tht one really sorry i m so confused thts why i didn,t explain it very well

oh really thnxxxx everyone reallllyyyyyyy thnxxx
but im stilll in prob :(
last thing friend can you tell me how can i add loop so all the programme starts again
the main prob is i m a beignner and i have to submit my assignment soon

You can do this...

//header files
int main()
{
//variable declarations
while(1)
{
//write your program code here it keeps on looping
.
.
.
.
//Some condition to break the looping if user wishes
}
return 0;
}

>the main prob is i m a beignner and i have to submit my assignment soon
Your only problem is that you have NOT read a book.
Go and get one and read it.

You have not impressed us a bit so that we should help you.
also read How to ask question the smart way

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.