C++ Projects

Project 3

Start Xcode.
Choose File > New Project to create a new project.
Choose a C++ Tool project, which is in the Command Line Utility section, and click the Next button.
Enter the name:
Enter the C++ source code exactly as it is shown.

// name: operating with variables

#include <iostream.h>
using namespace std;

int main ()
{
// declaring variables:
int a, b;
int result;

// process:
a = 5;
b = 2;
a = a + 1;
result = a - b;

// print out the result:
cout << result << "\n";

// terminate the program:
return 0;
}

Add you name as a comment // name under the title.
Add lines that output the names and the values of a and b.
Add your name cout << "by name"; as the last line of code.

Rename the picture to:
Upload to your Sites Homepage.

Final Code