Created
April 20, 2016 01:54
-
-
Save justgage/050cb05fced260e26229e0c85462ac04 to your computer and use it in GitHub Desktop.
A program to prove that I can C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************************************** | |
* 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