{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Unit 03 Test - UNIT03TEST 1..Aftercorrections,what ? int...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
UNIT 03 TEST 1. Identify syntax errors in the following program. After corrections, what  output would you expect when you execute it? Please turn in a working  version of this code so that we may check your corrections. int main void { float bigNumber = 0 int smallNumber = 0.0; cout << "Enter a big number << endl; cin >> bigNumber; cout << "Enter a small number" << endl; cin << smallNumber; int rem = bignumber % smallnumber; cout << "If you divide the big number by the small number\n"; cout << You have << rem << left over << endl; return 1.0; } # include <iostream> // this line was missing using namespace std; // this line was missing int main (void) // void in () { int bigNumber = 0; //bigNumber must be int, if used to solve for remainder, otherwise you will get decimal  answer, not remainder. missing ; at the end int smallNumber = 0; //smallNumber is int so = 0. cout << "Enter a big number " << endl; // missing end quote after number and before <<. cin >> bigNumber; cout << "Enter a small number" << endl; cin >> smallNumber; // wrond arrows, suppose to be opposite (>>). int rem = bigNumber % smallNumber; // better if used Hungarian notation for rem. And use same names 
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
at defined, bigNumber and smallNumber. cout << "If you divide the big number by the small number\n" << endl; // need to add << endl before ; cout << "You have "<< rem << " left over " << endl; // need " " on You have, and left over. 
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern