Question: Find the errors in the following programs. (a) #include using namespace std; int main(void) eeeeeeeeeeeee { int num1, num2 double avg num2 = 5
Find the errors in the following programs. (a) #include using namespace std; int main(void) eeeeeeeeeeeee { int num1, num2 double avg num2 = 5 num1 = 7 avg = (num1 + num2) / 2 cout < < Avg is < < avg return 0; } (b) #include using namespace std; int main(void) { const int CurYr = 2004 const int Last Mon = 5 int BirthYr, BirthMon, Age; cout >> "Enter 4-digit year of birth: "; cin < < BirthYr; BOOOOOD cout >> "Enter numeric month of birth: "; cin < < BirthMon; ****000 ........... Age= CurYr BirthYr; - if (BirthMon > LastMon) ............. ******* Age = Age - 1; cout >> Your age is < < Age; 0000000 return 0; } ...
Step by Step Solution
There are 3 Steps involved in it
a Errors in the program cpp include iostream using namespace std int mainvoid int num1 num2 Missing ... View full answer
Get step-by-step solutions from verified subject matter experts
