Are you looking for comments on coding style or on program logic? Style--things like brace placement and
other formatting--is subjective. You're not doing anything there that is egregious.
As far as program logic goes, it is hard to understand. kfmfe04's comment was in regards to the size of
the arrays vs. the number of characters you put in the array. The array need only be as big as the string
to fit in it. Although I see that while you are initializing with only 4 characters, you later read into it.
However, char arrays are C, not C++. The C++ way of dealing with strings is the std::string class.
1 2 3 4 5 6
|
while (imNint == 0)
{
cout << "silly" << anderson;
imNint++;
continue;
}
|
This loop will execute exactly once, every time. A loop that executes exactly once every time is not a loop.
It could be reduced to
cout << "silly" << anderson;
Same for the subsequent loops. The if()
check on 38 will always be true, so it is pointless to even check. The while loop on 9 will execute exactly
once, so it can be reduced.