C++ IS fun.
To day I had my first "lesson" and this is what I made, which was a lot more than asked (a simple "Hello World" type program):
// ConsoleApplication2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
//
#include "iostream"
using namespace std;
int main()
{ int in0 = 0;
int counter = 0;
cout << counter << endl;
do
{
counter = counter + 1;
if (counter == 5)
{
in0 = 1;
}
if (counter == 4)
{
cout << "Hello, this is simple for those who know what they are doing. counter = 4" << endl;
}
cout << counter << endl;
cout << "Hello, this is simple for those who know what they are doing." << endl;
}
while (in0 == 0);
system("pause");
}
Getting this to work was a b****, however. It actually stumped the instructor. The main problem? if (counter == 5) was if (counter = 5) See if you can figure out what happened . Need less to say, I may have given some ideas to the instructor with regards to the next lesson goal.
Also: Project1.zip Cover your ears.
11 Comments
Recommended Comments
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now