Computing.Net > Forums > Programming > C++ programming

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C++ programming

Reply to Message Icon

Name: ~BeBe~
Date: December 4, 2004 at 15:44:37 Pacific
OS: WinXP
CPU/Ram: 3.0Ghz
Comment:

Hi, I am really trying hard for this but can't get this thing to work. Here's what I want to do, If an User enters certain string, then I would like to print the Stringe that the user inputed. If the user leave it blank. Then I would like to print Car Rental INC by default. Below it what I come up with but it doesn't print whatever I enter. Please help me. Thanks


void RentalAccount::Print() const
{

string Company;


Company = ( this->companyName=="" ? "Car Rental INC": this->companyName );

cout<<"\nAccount Number: "<<this->accountNumber<<endl;
cout<<this->clientName<<", thank you for using "<<Company<<"."<<endl;
cout<<showpoint<<fixed<<setprecision(2);
cout<<"Your Balance is: $"<<this->balance<<endl;

}



Sponsored Link
Ads by Google

Response Number 1
Name: tImmaY
Date: December 5, 2004 at 23:45:14 Pacific
Reply:

hmm.. you use odd syntax that i've never seen. so i can't help you if theres a problem there..

however, why dont you just declare 2 strings. the 1 as you have it and then another that has car rental inc stored in it. then take in the users input and check to make sure that its not equal to "". if it is, display the string that has car rental inc stored in it.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C++ programming

c++ programming for novell www.computing.net/answers/programming/c-programming-for-novell/2525.html

Bike Trader C program www.computing.net/answers/programming/bike-trader-c-program/6557.html

C++ Programming Website www.computing.net/answers/programming/c-programming-website/4752.html