C++ is based on C, and C is known to be error-prone. This assignment is based on several of my student's programs from previous semesters.
Submit a text file that lists each method's header in the attached program and explain what the problem is. You may include the corrected code but you must describe what the core coding issues are.
The errors are all logical or syntax related. Just because it compiles and runs does not mean that is does what the author intended. These items are snippets. The problems are not style issues.
To get full credit, I need all scenarios answered and correct. I would expect that you tested out your code correction. I tend to assign low points if I can tell you did not test the proposed solution or incorrectly explained what the problem or solution is. To solve this issue, simply test out what you would change.
// MS Visual Studio 2015 uses "stdafx.h" - 2017 uses "pch.h"
//#include "stdafx.h"
//#include "pch.h"
#include
using namespace std;
void helloPlanet();
void bonusCheck();
bool whatIsMyResult();
void soTrue();
void hereIam();
void missCodedIF();
void loopForEachDayThisMonth();
// This program should run all the methods.
// Find the problem with the code
int main() {
helloPlanet();
bonusCheck();
bool result = whatIsMyResult();
soTrue();
missCodedIF();
loopForEachDayThisMonth();
return0;
}
// Compiles perfectly. What do you think this was intented to do?
void helloPlanet() {
"Program is starting ..";
}
// Why does this state You get a bonus now?
void bonusCheck() {
bool getBonus = false;
if (getBonus)
cout < "you="" are="" qualified!"=""><>
cout < "you="" get="" a="" bonus="" now!="" "=""><>
}
// What is the result of this method
bool whatIsMyResult() {
int x = 5;
int y = 6;
if (y == 5) {
if (x == 4) {
returntrue;
}
else {
returnfalse;
}
}
}
// Why does this not display?
void hereIam() {
cout < "do="" you="" see="" me?"=""><>
}
void soTrue() {
bool done = false;
if (done);
{
cout < "why="" do="" you="" see="" this="" when="" condition="" is="" false."=""><>
}
}
void missCodedIF() {
int x = 5;
if (x = 4) {
cout < "why="" do="" you="" see="" this="" line?."=""><>
}
}
void loopForEachDayThisMonth() {
// We will assume this is a 31 day month
// The loop should show "Got sales for " 1 - 31
int MAX_MONTH_DAY = 31;
int today = 0;
for (today = 1; today < (max_month_day="" +="" 1);="">
{
cout < "get="" sales="" for="" "="">< today=""><>
}
}