CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Jul 2009
    Posts
    14

    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;

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: dollar sign declaration

    can i just declare it in my list of declaration like this:
    try it and see what happens.

  3. #3
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    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
  •  





Click Here to Expand Forum to Full Width

Featured