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
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;
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.
Summary: Hello all, i'm having a bit of trouble with my basic C program. I'm not all to good with C as it stands anyway, so managed to find this place. I've been asked to make a program that is a little like a...