Monday, June 18, 2012

Homework 1

Intro:

1. Write a statement that prints  Hello World to the screen. 

cout << "Hello World " <<endl;

2.  Write a complete program that prints  Hello World to the screen. 

#include <iostream>
using namespace std;

int main()
{
cout << "Hello World " <<endl;
return 0;
}

3.  Suppose your name was Alan Turing. Write a statement that would print your last name, followed by a comma, followed by your first name. Do not print anything else (that includes blanks). 

cout << "Turing,Alan " <<endl;

4.  Suppose your name was George Gershwin. Write a complete program that would print your last name, followed by a comma, followed by your first name. Do not print anything else (that includes blanks). 

#include <iostream>
using namespace std;

int main()
{
cout << "Gershwin,George " <<endl;
return 0;
}

No comments:

Post a Comment