Question

C++ Code: How do I get this code to display True/False instead of 0/1? cout <<...

C++ Code:

How do I get this code to display True/False instead of 0/1?

cout << "Is the Mountain bike equal to BMX bike?: " << bikeBMXObj.equals(bikeMountainObj) << endl;
   cout << "Is the Standard bike equal to the Racer bike?: " << bikeRacerObj.equals(bikeStandardObj) << endl;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

cout << "Is the Mountain bike equal to BMX bike?: " << (bikeBMXObj.equals(bikeMountainObj) ? "true" : "false") << endl;
cout << "Is the Standard bike equal to the Racer bike?: " << (bikeRacerObj.equals(bikeStandardObj) ? "true" : "false") << endl;
Add a comment
Know the answer?
Add Answer to:
C++ Code: How do I get this code to display True/False instead of 0/1? cout <<...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • No- 11 What will be output by this code: A=false; B=false; C=false; D=true; if (A ==...

    No- 11 What will be output by this code: A=false; B=false; C=false; D=true; if (A == true && B == false)    if (C == true || D == false) cout << "one" << endl;    else if (D == true) cout << "two" << endl;           else cout << "three" << endl; else if (C == D) cout << "four" << endl;        else if (C == true) cout << "five" << endl; Group of answer choices

  • How do can I update this code (Code A): Code (A) #include using namespace std; int fibonacci(int n) { int a = 0,...

    How do can I update this code (Code A): Code (A) #include using namespace std; int fibonacci(int n) { int a = 0, b = 1, c; if (n <= 1) return n; for (int i = 2; i <= n; i++) { c = a + b; a = b; b = c; } return b; } int fibonacciRecursive(int n) { if (n <= 1) { return n; } return fibonacciRecursive(n-1) + fibonacciRecursive(n-2); } int main() { int n;...

  • Can I get a C++ code and output for this program using classes instead of using...

    Can I get a C++ code and output for this program using classes instead of using struct. The following program implements a Last In First Out (LIFO) stack. ( I want to use class for function definitions too and if main need.) #include <iostream> using namespace std; const int MAX = 100; struct stack {    int s[MAX]; // an array of integers    int top; // the index of the last number }; void push(stack &, int); void pop(stack&,...

  • How do I get this code to output The monthly payment is too low resulting in...

    How do I get this code to output The monthly payment is too low resulting in the loan amount not being able to be repaid, if the monthly payment is not higher than the interest rate. Right now I cant get it to say that. #include <iostream> using namespace std; int main() {    double monthlyPayment;    double remainingBalance;    double interestRate;    int month = 1;    cout.setf(ios::fixed);    cout.setf(ios::showpoint);    cout.precision(2);    cout << "Enter loan amount: $";...

  • How can I write this code (posted below) using vectors instead of arrays? This is the...

    How can I write this code (posted below) using vectors instead of arrays? This is the task I have and the code below is for Task 1.3: Generate twenty random permutations of the number 0, 1, 2, ..., 9 using of the algorithms you designed for Task 1.3. Store these permutations into a vector and print them to the screen with the additional information of unchanged positions and number of calls torand(). Calculate the total numbers of unchanged positions. Compare...

  • How many Iterations will this while loop perform? int ico), j(10); cout << "i = "...

    How many Iterations will this while loop perform? int ico), j(10); cout << "i = " << i << endl; cout << "j = " << j << endl; while (i > j) { cout << "j-" « j << endl; j += 2; cout << "i = " << i << endl; } cout << "i = << i << endl; cout << "j = " << j << endl; 5 6 C 8 10 Infinite times Does the...

  • C++ language I need to update this code with the following: ask the user for how...

    C++ language I need to update this code with the following: ask the user for how many structures they would like. Once you get the number, allocate an array of pointers. Once they have been created, proceed to loop through and get the data as usual, and display it back to the screen. struct record {    int age;    string name; }; int check(record r[], int n, string nm) {    for (int i = 0; i < n;...

  • Can you help me explain how fork, getpid(), cout work in this code? I got a...

    Can you help me explain how fork, getpid(), cout work in this code? I got a quiz today which asked me how many times cout and fork() is executed. #include <iostream> #include <unistd.h> using namespace std; int main ( int argc, char *argv [] ) { int pid; cout << getpid()<<endl; pid = fork(); if (pid == 0) { cout << getpid() <<endl; fork(); cout << getpid()<<endl; fork(); cout << getpid()<<endl; } return 0; }

  • im writing a c++ code and getting stuck on two parts. The first part, when I...

    im writing a c++ code and getting stuck on two parts. The first part, when I go to write the customer order out to the file, it writes everything but the price out right. I'll get a weird number like 5.95828e-039 or nan. When I printout to the console it works fine so not sure what's wrong. Second After I write the order out to the file, I then have to go in and read the file and calculate the...

  • I Need Help. I MUST USED VECTOR OF STRUCTUERS INSTEAD OF AN ARRAY. HOW CAN MAKE...

    I Need Help. I MUST USED VECTOR OF STRUCTUERS INSTEAD OF AN ARRAY. HOW CAN MAKE THIS INTO VECTOR STRUCTUERS? #include #include using namespace std; // This program demonstrates how to use an array of structures// PLACE YOUR NAME HERE // Fill in code to define a structure called taxPayer that has three// members: taxRate, income, and taxes -- each of type float int main(){   // Fill in code to declare an array named citizen which holds   // 5 taxPayers structures cout...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT