Unit 03 Test - UNIT03TEST

Info iconThis 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 
Background image of page 1

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

View Full DocumentRight 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 ;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Unit 03 Test - UNIT03TEST

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online