Using what you've learned from the first C++ 101 Session...
Now that the first session of C++ 101 is over, it is now time to use what you have learned to create a simple program. For example, here is a program that I wrote that utilizes variables, an if/else statement, operators, and user input:
Code:
#include <iostream>
using namespace std;
int main()
{
int sum;
int number;
cout << "Select a three-digit number\n";
cout << "All three digits the same...\n";
cout << "\nAdd the three digits together...\n";
cout << "\nWhat is the sum of the three digits? ";
cin >> sum;
if (sum < 3 && sum > 27)
{
cout << "Sorry, but the end number must have three equal digits.\n";
}
else
{
number = 37 * sum;
cout << "\n\nYour Number Is: " << number;
}
cin.get();
cin.ignore();
return 0;
}
Which results in this:

Now with this in mind, let's see what you can come up with based on yesterday's or Monday afternoon's class sessions, and be creative with it, yet stick to what you have learned so far. Good luck!
I just thought that "Well, since it was an introductory lesson, and there wasn't any homework, that doesn't mean that we can't prove what was learned in some form." So that's how I came up with this thread, in case you were curious.
Last edited by WedgeBob; 04-14-2012 at 07:20 AM.
PC Specs: Antec 900 ATX Case, Gigabyte 790GX Mobo, AMD Phenom II x4 955, Corsair HX620W PSU, Corsair Vengeance 16GB (4x4GB) DDR3-1600, EVGA GTX 680 2GB GDDR5, 3D Vision Kit 2, LG 8x Blu-ray Burner, Intel X25-M SSD, 500GB+640GB WD Caviar Blacks, Win 7 Pro x64, DAS Pro K/B, MX518 Mouse, Logitech Z-2300 Speakers, Toshiba 32TL515U 32" 3DTV, Wacom Bamboo Fun Large Tablet.