Skip to content

Instantly share code, notes, and snippets.

@itsjohncs
Created October 8, 2012 05:28
Show Gist options
  • Save itsjohncs/3850867 to your computer and use it in GitHub Desktop.
Save itsjohncs/3850867 to your computer and use it in GitHub Desktop.
CS 10 SI Classroom Session 2 - Example 1
Twix
Fido
John
Smith
47
Skittles
Hammy
Daniel
de Haas
20
Starburst Starla Sarah Fredrickson 82
#include <iostream>
using namespace std;
int main() {
string faveCandy;
string firstPet;
string firstName;
string lastName;
int age;
cout << "Enter your favorite candy: ";
cin >> faveCandy;
cout << "Enter the name of your first pet: ";
cin >> firstPet;
cout << "Enter your first and last name: ";
cin >> firstName >> lastName;
cout << "Enter your age: ";
cin >> age;
cout << endl;
cout << "Your name is " << firstName << " " << lastName
<< " and your first pet's name was " << firstPet
<< " and your favorite candy is " << faveCandy << " and you are "
<< age << " years old." << endl;
return 0;
}
@paranoiacblack
Copy link

I added comments demonstrating how to comment and explaining various parts of this code in my fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment