-
July 27th, 2009, 10:32 AM
#1
dollar sign declaration
i am doing a program on budget at the moment and have already finished the program. The program uses a lot of dollar sign for output. MY question is, instead of having to put in "$" every time in each output, can i just declare it in my list of declaration like this:
char dollar='$';
hence i could use it in the following manner;
cout<<dollar<<housing<<endl;
cout<<dollar<<food<<endl;
instead of
cout<<"$"<<housing<<endl;
-
July 27th, 2009, 11:09 AM
#2
Re: dollar sign declaration
can i just declare it in my list of declaration like this:
try it and see what happens.
-
July 27th, 2009, 03:46 PM
#3
Re: dollar sign declaration
You could.....but I'm not sure why you'd want to. Since "dollar" is six characters and "$" is 3.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|