Output spacing problem

This is a discussion on Output spacing problem within the C++ Programming forums, part of the General Programming Boards category; Code: cout << "Patient's name " << name ;cout << "Cleaning Charge is " << cbill ;cout << "Cavity filling ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    27

    Output spacing problem

    Code:
         cout << "Patient's name " << name 
        
        ;cout << "Cleaning Charge is  " << cbill 
        
        ;cout << "Cavity filling charge is  " << cavbill  
        
        ;cout << "X-ray charge is  " << xbill 
        
        ;cout << "Total bill for services is: " << totalbill 
              << endl <<endl;
    The result is all the information running together like a paragraph. How can I have each line of information display individually? When I use the "endl" command I get "statement can't resolve address of overloaded function". Thanks!

  2. #2
    The Richness... Richie T's Avatar
    Join Date
    Jan 2006
    Location
    Ireland
    Posts
    469
    post some code with your attempt using endl, might be using it
    wrong

    edit: its common coding practice to put the semicolons at the
    end of a line of code, not the start
    No No's:
    fflush (stdin); gets (); void main ();


    Goodies:
    Example of fgets (); The FAQ, C/C++ Reference


    My Gear:
    OS - Windows XP
    IDE - MS Visual C++ 2008 Express Edition


    ASCII stupid question, get a stupid ANSI

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    27
    Quote Originally Posted by Richie T
    post some code with your attempt using endl, might be using it
    wrong
    Code:
    // display output
        cout << "Patient's name " << name ;endl
        
        ;cout << "Cleaning Charge is  " << cbill 
        
        ;cout << "Cavity filling charge is  " << cavbill  
        
        ;cout << "X-ray charge is  " << xbill 
        
        ;cout << "Total bill for services is: " << totalbill 
              << endl <<endl;
        
        return 0;
    }

  4. #4
    The Richness... Richie T's Avatar
    Join Date
    Jan 2006
    Location
    Ireland
    Posts
    469
    you cant just type endl, need to be within cout and also need <<
    change code to this, and also i editted my previous post. read
    that, this should work now

    cout << "Patient's name " << name<<endl;

    cout << "Cleaning Charge is " << cbill<<endl;

    cout << "Cavity filling charge is " << cavbill <<endl;

    cout << "X-ray charge is " << xbill <<endl;

    cout << "Total bill for services is: " << totalbill << endl <<endl;

    return 0;
    }
    No No's:
    fflush (stdin); gets (); void main ();


    Goodies:
    Example of fgets (); The FAQ, C/C++ Reference


    My Gear:
    OS - Windows XP
    IDE - MS Visual C++ 2008 Express Edition


    ASCII stupid question, get a stupid ANSI

  5. #5
    Registered User
    Join Date
    Jan 2006
    Posts
    27
    Thank you so much!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with my output
    By Dogmasur in forum C Programming
    Replies: 17
    Last Post: 08-07-2008, 08:07 PM
  2. Hash Table Problem.
    By penance in forum C Programming
    Replies: 9
    Last Post: 07-24-2005, 01:03 PM
  3. output from bank type problem
    By IzaakF in forum C Programming
    Replies: 2
    Last Post: 09-04-2002, 06:42 PM
  4. File input output problem
    By VanJay011379 in forum C++ Programming
    Replies: 2
    Last Post: 08-30-2002, 02:09 PM
  5. String Output Problem
    By Yin in forum C++ Programming
    Replies: 3
    Last Post: 03-14-2002, 06:36 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21