Skip to content

Instantly share code, notes, and snippets.

@justgage
Created April 20, 2016 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justgage/050cb05fced260e26229e0c85462ac04 to your computer and use it in GitHub Desktop.
Save justgage/050cb05fced260e26229e0c85462ac04 to your computer and use it in GitHub Desktop.
A program to prove that I can C++
/***********************************************************************
* Program:
* Lab 00, Practice Lab Submission
* Brother Jones, CS345
* Author:
* Gage Peterson
* Summary:
* This is the first lab. It will count the number of lines the user
* enters that begin a capital letter
************************************************************************/
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
/**********************************************************************
* Counts the number of lines the user enters that start with an
* uppercase letter
***********************************************************************/
int main()
{
string inputLine;
int count = 0;
bool keepGetting = true;
while (keepGetting)
{
cout << "Enter an integer: ";
int temp;
cin >> temp;
if (temp == 0)
keepGetting = false;
else
count++;
}
if (count == 0)
cout << "No non-zero integers were entered.\n";
else {
cout << "You entered " << count
<< (count == 1 ? " integer." : " integers.")
<< endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment