#include <math.h>
#include <apstring.cpp>
#include <apstring.h>
#include <iomanip.h>
#include <iostream>
#include <stdio.h>
int birthdayProgram();
int pizzaProgram();
int oddEvenProgram();
int incomeProject();
int examProgram();
int dhsProgram();
int drivingProgram();
int shapesProgram();
int circleProgram();
int biggerNumber();
int paintProgram();
int all_in_one_Program();
int temperatureProgram();
int printTitle();/*DONE*/
int teachingProgram();
double fahrenheitToCelsius ( double userTemperature );
double celsiusToKelvin ( double userTemperature );
double kelvinToCelsius ( double userTemperature );
double kelvinTofahrenheit ( double userTemperature );
double fahrenheitToKelvin ( double userTemperature );
double celsiusToFarenheit ( double userTemperature );
using namespace std; //introduces namespace std
int main()
{
int userNumber = 0;
int userChoice = 0;
int run = 0;
/*if
{
}
else
for(pre;check;post;)
{
}
do{
}while (var == true);
switch(var)
{
case 1: {
break;
}
default:{
break;
}
}
cout << "This is a test" ;*/
char continueYN = 'a';
cout << "Super Program\n";
cout << "Please choose a program to run.\n";
cout << "[x]....................................[x]...................................." << endl;
cout << "[1] Display Shapes [2] Properties Of A Circle" << endl;
cout << "[3] Determine Paint Needed [4] Convert Temperatures" << endl;
cout << "[5] Driving Age & Voting Qualification [6] Display Letters "DHS"" << endl;
cout << "[7] Qualifications to exempt an exam [8] Possible Financial Aid" << endl;
cout << "[9] Determine ODD/EVEN Numbers [10] Determine Cost Of Slice Of Pizza" << endl;
cout << "[11] Determine Which Day You Were Born [12] ALL-IN-ONE Program" << endl;
cin >> userChoice;
cout << userChoice;
if (userChoice == 0){
system("CLS");
run = shapesProgram();
}
if (userChoice == 1){
system("CLS");
run = circleProgram();
}
if (userChoice == 2){
system("CLS");
run = biggerNumber();
}
if (userChoice == 3){
system("CLS");
run = paintProgram();
}
if (userChoice == 4){
system("CLS");
run = temperatureProgram();
}
if (userChoice == 5){
system("CLS");
run = drivingProgram();
}
if (userChoice == 6){
system("CLS");
run = dhsProgram();
}
if (userChoice == 7){
system("CLS");
run = examProgram();
}
if (userChoice ==
{
system("CLS");
run = incomeProject();
}
if (userChoice == 9){
system("CLS");
run = oddEvenProgram();
}
if (userChoice == 10){
system("CLS");
run = pizzaProgram();
}
if (userChoice == 11){
system("CLS");
run = birthdayProgram();
}
if (userChoice == 13){
system("CLS");
run = all_in_one_Program();
}
if (userChoice == 12){
system("CLS");
cout << "This is using the header IOSTREAM. Displaying information to the screen is used by "cout << "ENTER TEXT HERE"\\n";
cout << "This is using the header IOSTREAM. Taking values from a user is used by "cin >> "variable"\n Please enter a number:\n";
cin >> userNumber;
cout << "\nYou have entered " << userNumber << endl;
}
return 0;
}
/**************************************************
This section is for program documentation.
What the purpose of the program is and what it does.
List Input: Radius
List Output: Area, Diameter, Circumference
Name: RAWR IMA CENSOR THIS PLZKTHNX
Date: 9/03/09
Saved as: First Program.cpp
**************************************************/
//Libraries used, and what is used from each
int shapesProgram()
{
cout << "**********" << " " << " *** " << " " << " * " << " " << " * " << endl;
cout << "* *" << " " << " * * " << " " << " *** " << " " << " * * " << endl;
cout << "* *" << " " << "* *" << " " << "*****" << " " << " * * " << endl;
cout << "* *" << " " << "* *" << " " << " * " << " " << " * * " << endl;
cout << "* *" << " " << "* *" << " " << " * " << " " << "* *" << endl;
cout << "* *" << " " << "* *" << " " << " * " << " " << " * * " << endl;
cout << "* *" << " " << "* *" << " " << " * " << " " << " * * " << endl;
cout << "* *" << " " << " * * " << " " << " * " << " " << " * * " << endl;
cout << "**********" << " " << " *** " << " " << " * " << " " << " * " << endl;
return 0;
}
int circleProgram()
{
//Variable declaration section
int radius = 0;
//Execution section
cout << "Please enter the radius of a circle: ";
cin >> radius;
cout << endl;
cout << "The DIAMETER of the circle (with the radius of " << radius << ") is: " ; //Tells the diameter of the circle
cout << radius * 2 << " centimeters" << endl;
cout << "The AREA of the circle (with the radius of " << radius << ") is: "; //Tells the area of the circle
cout << 3.14 * radius << " centimeters" << endl;
cout << "The CIRCUMFERENCE: of the circle (with the radius of " << radius << ") is: "; //Tells the circumference of the circle
cout << 2 * 3.14 * radius << " centimeters" << endl;
cout << "Please press any key to terminate the program." << endl;
return 0;
}
int biggerNumber()
{
int firstNumber = 0;
int secondNumber = 0;
cout << "Enter The first Number, and i tell which is bigger." << endl;
cin >> firstNumber;
cout << "Enter The second Number, and me tells you which is bigger." << endl;
cin >> secondNumber;
if ( firstNumber > secondNumber )
{
cout << firstNumber << " is obviously bigger than " << secondNumber << endl;
}
if ( secondNumber > firstNumber )
{
cout << secondNumber;
cout << " is obviously bigger than ";
cout << firstNumber << endl;
}
else
{
cout << "The numbers are obviously the same.\n" << endl;
}
cout << "\nPlease enter a new number! \n";
cin >> firstNumber;
cout << "\nPlease enter a new number! \n";
cin >> secondNumber;
{
if ( firstNumber > secondNumber )
cout << firstNumber << " is obviously bigger than " << secondNumber << endl;
}
if ( secondNumber > firstNumber )
{
cout << secondNumber << " is obviously bigger than " << firstNumber << endl;
}
else
{
cout << "The numbers are obviously the same.\n" << endl;
}
return 0;
}
int paintProgram()
{
//Variable Declaration Section
int roomLength = 0;
int roomWidth = 0;
int roomHeight = 0;
int paintCoverage = 0;
int coatAmounts = 0;
int paintColor = 'a';
float costGallonPaint = 0.0;
float totalCost = 0.0;
float taxPercent = 0;
float costGallonsTotal = 0.0;
int gallonsNeeded = 0;
int ceilingWall = 0;
int widthHeightWall = 0;
int heightLengthWall = 0;
int totalAreaRoom = 0;
float finalCostBeforeTax = 0.0;
float taxPercentDecimal = 0.0;
float finalDisplayCost = 0.0;
//Execution Section
cout << "Please enter the LENGTH of a room in feet. \n" ;
cin >> roomLength;
cout << "\nPlease enter the WIDTH of a room in feet. \n" ;
cin >> roomWidth;
cout << "\nPlease enter the HEIGHT of a room in feet. \n" ;
cin >> roomHeight;
cout << "\nPlease enter the COVERAGE of paint per square foot. \n" ;
cin >> paintCoverage;
cout << "\nHow many COATS of paint would you need. \n";
cin >> coatAmounts;
cout << "\nPlease enter the COST of paint PER GALLON.\n$" ;
cin >> costGallonPaint;
cout << "\nPlease enter the tax rate for your state. (As a whole number.)\n" ;
cin >> taxPercent;
//Displays Room Dimensions
cout << "\nROOM DIMENSIONS\n";
cout << "Length : " << roomLength << " feet.\n";
cout << "Width : " << roomWidth << " feet.\n";
cout << "Height : " << roomHeight << " feet.\n";
cout << "Paint Coverage : " << paintCoverage << " per sq. ft. per gallon.\n";
cout << "Amounts Of Coats : " << coatAmounts << " coats.\n" ;
cout << "Cost per gallon of paint : $" << costGallonPaint << " per gallon.\n";
cout << "Tax rate : " << taxPercent << "%\n";
//Total Price Definitions
widthHeightWall = roomWidth * roomHeight * 2; //Two Side Walls
heightLengthWall = roomHeight * roomLength * 2; //Other Two Walls
ceilingWall = roomLength * roomWidth; //Ceiling Area
totalAreaRoom = ((widthHeightWall + heightLengthWall + ceilingWall)*coatAmounts);
if ( totalAreaRoom % paintCoverage != 0 )// >0 or != 0
{
gallonsNeeded = (totalAreaRoom / paintCoverage) + 1;
}
else
{
gallonsNeeded = (totalAreaRoom / paintCoverage);
}
costGallonsTotal = gallonsNeeded * costGallonPaint;
finalCostBeforeTax = costGallonsTotal * (1+(taxPercent/100));
cout << "Gallons Needed : " << gallonsNeeded << "\n";
cout << "TOTAL PRICE\n";
//Final Calculation Section
cout << "Calculations Done!\n\n";
cout << "The Total Cost To Paint Your Room Is $";
finalDisplayCost = finalCostBeforeTax;
cout << finalDisplayCost;
return 0;
}
int temperatureProgram()
{
double userTemperature = 0.0 ;
double celsius = 0.0 ;
double fahrenheit = 0.0 ;
double kelvin = 0.0;
int userChoice = 0;
char continueYN = 'a';
do{//loop open
userChoice = printTitle ();
cout.precision(2);
cout.setf(ios::fixed|ios::showpoint);
switch(userChoice){
case 1:
{
cout << "Please enter the temperature in degrees Celsius.\n";
cin>> userTemperature;
fahrenheit = celsiusToFarenheit (userTemperature) ;
cout << userTemperature << " degrees celsius is equal to " << fahrenheit << " degrees Fahrenheit.\n";
break;
}
case 2:
{
cout << "Please enter the temperature in degrees Celsius.\n";
cin>> userTemperature;
kelvin = celsiusToKelvin (userTemperature);
break;
}
case 3:
{
cout << "Please enter the temperature in degrees Fahrenheit.\n";
cin>> userTemperature;
celsius = fahrenheitToCelsius (userTemperature) ;
break;
}
case 4:
{
cout << "Please enter the temperature in degrees Fahrenheit.\n";
cin>> userTemperature;
kelvin = fahrenheitToKelvin (userTemperature) ;
break;
}
case 5:
{
cout << "Please enter the temperature in Kelvin.\n";
cin>> userTemperature;
fahrenheit = kelvinTofahrenheit (userTemperature);
break;
}
case 6:
{
cout << "Please enter the temperature in Kelvin.\n";
cin>> userTemperature;
celsius = kelvinToCelsius (userTemperature) ;
break;
}
default:{
cout << "That is an invalid selection\n";
break;
}
}
cout << "Would you like to restart? Y/N\n";
cin >> continueYN;
if (continueYN == 'Y' || continueYN == 'y'){
system("cls");}
else
cout << "Goodbye.\n";
}//loop closed
while (continueYN == 'Y' || continueYN == 'y');
return 0;
}
double celsiusToFarenheit (double userTemperature )
{
double fahrenheit = 0;
fahrenheit = ((userTemperature*(9.0/5.0))+32.0);
return fahrenheit;
}
double fahrenheitToKelvin ( double userTemperature )
{
double kelvin = 0;
double partOne = 0.0;
partOne = (5.0 /9.0) * (userTemperature - 32.0);
kelvin = partOne + 273.15 ;
cout << userTemperature << " degrees Fahrenheit is equal to " << kelvin << " Kelvin.\n";
return kelvin;
}
double kelvinTofahrenheit ( double userTemperature )
{
double fahrenheit = 0;
fahrenheit = ((9.0 /5) * userTemperature) + 32.0;
fahrenheit = userTemperature + 273.15 ;
cout << userTemperature << " Kelvin is equal to " << fahrenheit << " degrees Fahrenheit.\n";
return fahrenheit;
}
double kelvinToCelsius ( double userTemperature )
{
double celsius = 0;
celsius = userTemperature - 273.15;
cout << userTemperature << " Kelvin is equal to " << celsius << " degrees Celsius.\n";
return celsius ;
}
double fahrenheitToCelsius ( double userTemperature )
{
double celsius = 0;
celsius = ((9.0/5.0) * userTemperature) + 32.0;
cout << userTemperature << " degrees Fahrenheit is equal to " << celsius << " degrees Celsius.\n";
return celsius ;
}
double celsiusToKelvin ( double userTemperature )
{
double kelvin = 0;
kelvin = userTemperature + 273.15;
cout << userTemperature << " degrees Celsius is equal to " << kelvin << " Kelvin.\n";
return kelvin ;
}
int printTitle()
{
int userChoice = 0;
cout << "Please make a selection.\n";
cout << "1. Celsius to Fahrenheit"<< endl;
cout << "2. Cesius to Kelvin"<< endl;
cout << "3. Fahrenheit to Celsius"<< endl;
cout << "4. Fahrenheit to Kelvin "<< endl;
cout << "5. Kelvin to Fahrenheit"<< endl;
cout << "6. Kelvin to Celsius "<< endl;
cin >> userChoice;
return userChoice;
}
int drivingProgram()
{
int userAge = 0;
int license = 0;
cout << "Hello! In this program, we can determine if you are legally able to vote and legally able to drive!\n" ;
cout << "Please enter your age: \n";
cin >> userAge;
cout << "These are your results!\n";
if ( userAge < 16 )
{
cout << " You cannot drive. \n Nor can you vote. \n";
}
if ( userAge == 16 )
{
cout << " You may drive, but you cannot vote. \n";
}
if ( userAge > 16 )
{
cout << " You may drive \n";
}
if ( userAge == 17 )
{
cout << " You may not vote. \n";
}
if ( userAge >= 18 )
{
cout << " You may vote! \n";
}
return 0;
}
/*
CHECK LIST
Int*/
int dhsProgram()
{
cout << "***** * * *** " << endl;
cout << "* * * * * * " << endl;
cout << "* * * * * " << endl;
cout << "* * * * * " << endl;
cout << "* * ****** *** " << endl;
cout << "* * * * * " << endl;
cout << "* * * * * " << endl;
cout << "* * * * * " << endl;
cout << "* * * * * * " << endl;
cout << "***** * * **** " << endl;
return 0;
}
int examProgram()
{
float studentAverage = 0.0;
int amountAbsenses = 0;
cout << "Hello! This program will be able to determine if you are able to exempt an exam.\nPlease enter you average. (Example : 98.32)\n" ;
cin >> studentAverage;
cout << "My Average Is " << studentAverage << "%\n\n";
cout << "Please enter how many unexcused absenses you have.\n";
cin >> amountAbsenses;
//Able To Exempt If Statements
[You must be registered and logged in to see this link.] Average
if ( studentAverage <= 84.99 )
{
cout << "You May Not Exempt This Exam!";
}
//85+ Average
if ( studentAverage >= 85.00 )
{
//START
{
////////////////////////////////////////////////////////////////////////
if ( studentAverage >= 90.00 )
{
if ( amountAbsenses <= 3 )
{
cout << "You May Exempt This Exam!";
}
if ( amountAbsenses >=3 )
{
cout << "You May Not Exempt This Exam!";
}
}
////////////////////////////////////////////////////////////////////////
if ( studentAverage <= 89.99 )
{
if ( amountAbsenses == 0 )
{
cout << "You May Exempt This Exam!";
}
if ( amountAbsenses != 0 )
{
cout << "You May Not Exempt This Exam!";
}
}
////////////////////////////////////////////////////////////////////////
}
}
//
return 0;
}
float ruleOneFunction (float familyIncome, int baseIncome, int incomeFactor);
float ruleTwoFunction (const int baseSavingsAndAssets, const int assetsFactor, float savings, float assets, float personalDebt, float mortgage);/*INSERT PARAMETERS!!!!!!!!!!!!!!!!!!!!*/
float ruleThreeFunction (float ruleOneResult, float ruleTwoResult);
float ruleFourFunction (float tuitionAndFees, float booksAndSupplies, float roomingCost, float boardingCost, float personalExpenses, float ruleThreeResult);
float ruleFiveFunction (int childrenAmount, float possibleFinancialAid);
float ruleSixFunction (float possibleFinancialAid);
int incomeProject()
{
float familyIncome = 0.0;
int savings = 0;
float assets = 0.0;
float personalDebt = 0.0;
float mortgage = 0.0;
const int baseSavingsAndAssets = 10000.0;
const int assetsFactor = 100;
const int baseIncome = 15000;
const int incomeFactor = 5;
float ruleOneResult = 0.0;
float ruleTwoResult = 0.0;
float ruleThreeResult = 0.0;
float ruleFourResult = 0.0;
float tuitionAndFees = 0.0;
float booksAndSupplies = 0.0;;
float roomingCost = 0.0;
float boardingCost = 0.0;
float personalExpenses = 0.0;
int childrenAmount = 0.0;
float largestResult = 0.0;
int childrenVarCorrect = 0;
float possibleFinancialAid = 0.0;
char continueYN = 'a';
do{
cout << "Please enter your family income. ie - 0.00.\n";
cin >> familyIncome;
cout << "Please enter your savings. ie - 0.00.\n";
cin >> savings;
cout << "Please enter your assets.\n";
cin >> assets;
cout << "Please enter your personal debt.\n";
cin >> personalDebt;
cout << "Please enter your mortgage\n";
cin >> mortgage;
cout << "Please enter the cost for books and supplies\n";
cin >> booksAndSupplies;
cout << "Please enter the cost for rooming.\n";
cin >> roomingCost;
cout << "Please enter boarding cost.\n";
cin >> boardingCost;
cout << "Please enter personal expenses.\n";
cin >> personalExpenses;
tuitionAndFees = booksAndSupplies+roomingCost+boardingCost+personal Expenses;
cout << "Please enter the number of children living in your household.\n";
cin >> childrenAmount;
system("CLS");
ruleOneResult = ruleOneFunction(familyIncome, baseIncome, incomeFactor);
ruleTwoResult = ruleTwoFunction(baseSavingsAndAssets, assetsFactor, savings, assets, personalDebt, mortgage);
largestResult = ruleThreeFunction(ruleOneResult, ruleTwoResult);
ruleThreeResult = largestResult;
possibleFinancialAid = ruleFourFunction( tuitionAndFees, booksAndSupplies, roomingCost, boardingCost, personalExpenses, ruleThreeResult);
possibleFinancialAid = ruleFiveFunction(childrenAmount, possibleFinancialAid);
possibleFinancialAid = ruleSixFunction(possibleFinancialAid);
cout << "Your family income is $" << familyIncome << ".\n";
cout << "Your savings is $" << savings << ".\n";
cout << "Your assets is $" << assets << ".\n";
cout << "Your debt is $" << personalDebt << ".\n";
cout << "Your mortgage is $" << mortgage << ".\n";
cout << "The cost for your tuition and fees is $" << tuitionAndFees << ".\n";
cout << "The cost for books and supplies is $" << booksAndSupplies << ".\n";
cout << "The cost for boarding is $" << boardingCost << ".\n";
cout << "The cost of personal expenses is $" << personalExpenses << ".\n";
cout << "There are currently " << childrenAmount << " children living in your house.\n";
cout << "You qualify for $" << possibleFinancialAid << " of financial aid!\n";
cout << "Would you like to restart? Y/N\n";
cin >> continueYN;
if (continueYN == 'Y' || continueYN == 'y')
{
system("CLS");
}
}while (continueYN == 'Y' || continueYN == 'y');
return 0;
}
float ruleOneFunction (float familyIncome, int baseIncome, int incomeFactor)
{
float ruleOneResult = 0.0;
ruleOneResult = 0.0;
ruleOneResult = ((familyIncome-baseIncome)/incomeFactor);
if (ruleOneResult >= 0)
{
ruleOneResult = ruleOneResult;
}
else
{
ruleOneResult = 0.0;
}
return ruleOneResult;
}
float ruleTwoFunction (const int baseSavingsAndAssets, const int assetsFactor, float savings, float assets, float personalDebt, float mortgage)
{
float ruleTwoResult = 0.0;
float savingsAndAssets = 0.0;
savingsAndAssets = ((savings + assets) - (personalDebt + mortgage));
ruleTwoResult = ((savingsAndAssets - baseSavingsAndAssets) / (assetsFactor));
if (ruleTwoResult >= 0)
{
ruleTwoResult = ruleTwoResult;
}
else
{
ruleTwoResult = 0.0;
}
return ruleTwoResult;
}
float ruleThreeFunction (float ruleOneResult, float ruleTwoResult)
{
float constantMinimum = 500.0;
float largestResult = 0.0;
largestResult = constantMinimum;
if ( ruleOneResult > largestResult )
{
largestResult = ruleOneResult;
}
if ( largestResult < ruleTwoResult )
{
largestResult = ruleTwoResult;
}
return largestResult;
}
float ruleFourFunction (float tuitionAndFees, float booksAndSupplies, float roomingCost, float boardingCost, float personalExpenses, float ruleThreeResult)
{
float possibleFinancialAid = 0.0;
float expensesOfCollege = tuitionAndFees+booksAndSupplies+roomingCost+boardi ngCost+personalExpenses;
possibleFinancialAid = expensesOfCollege - ruleThreeResult;
return possibleFinancialAid;
}
float ruleFiveFunction (int childrenAmount, float possibleFinancialAid)
{
switch( childrenAmount)
{
case 1:
{
possibleFinancialAid = ((.20)*(possibleFinancialAid));
break;
}
case 2:
{
possibleFinancialAid = ((.50)*(possibleFinancialAid));
break;
}
case 3:
{
possibleFinancialAid = ((.85)*(possibleFinancialAid));
break;
}
default:
{
possibleFinancialAid = possibleFinancialAid;
break;
}
}
return possibleFinancialAid;
}
float ruleSixFunction (float possibleFinancialAid)
{
if (possibleFinancialAid > 2500)
{
possibleFinancialAid = 2500.00;
}
else
possibleFinancialAid = possibleFinancialAid;
return possibleFinancialAid;
}
int oddEvenProgram()
{
//variable declaration
int userNumber = 0;
int letter = 'a';
//execution section
cout << "I can tell you if a number is odd, or even! \nPlease input a number: \n" ;
cin >> userNumber;
if ( userNumber % 2 > 0 )
{
cout << "Your Number Is Odd!\n";
}
else
cout << "Your Number Is Even!\n";
return 0;
}
int pizzaProgram()
{
const float pi = 3.1415926;
float pizzaCost = 0.0;
float pizzaDiameter = 0.0;
float pizzaPieces = 0.0;
float costPerSlice = 0.0;
float costPerInch = 0.0;
float pizzaArea = 0.0;
char continueYN = 'a';
do
{
cout << "What is the diameter of the pizza in inches?\n";
cin >> pizzaDiameter;
cout << "How many pieces is the pizza cut into?\n";
cin >> pizzaPieces;
cout << "What is the cost of the pizza?\n";
cin >> pizzaCost;
pizzaArea = pizzaDiameter * pi;
costPerSlice = pizzaArea/pizzaPieces;
costPerInch = pizzaArea/pizzaCost;
cout.precision(2);
cout.setf(ios::fixed|ios::showpoint);
cout << "For a " << pizzaDiameter << " inch pizza the cost is $" << costPerSlice << " per slice and $" << costPerInch << " per square inch.";
cout << "\nWould you like to continue? Y/N\n";
cin >> continueYN;
if ( continueYN == 'Y' )
{
system("CLS");
}
else
system("CLS");
cout << "Bye~ Program Terminated.\n";
}
while ( continueYN == 'Y' );
return 0;
}
int birthdayProgram()
{
//system ("COLOR 0F");//color
//system ("PAUSE");//colorEnd
int birthMonth = 0;
int birthYear = 0;
int birthDate = 0;
int total = 0;
int totalRemainder = 0;
int birthYear2Digits = 0;
char continueYN = 'a'; //For Continuing And Looping
do{
cout << "Hello.\tThis program will determine the day of the week you were\n";
cout << "born on, given the year you were born, the month you were born on,";
cout << "and the date,\nAssuming you were born in the 19th century.\n";
cout << "\nPlease Enter The Month You Were Born In.\n";
cout << "1 January 4 April 7 July 10 October\n";
cout << "2 February 5 May 8 August 11 November\n";
cout << "3 March 6 June 9 September 12 December\n";
cin >> birthMonth;
switch( birthMonth ){//opens switch
case 1: //JANUARY
{
cout << "Please enter your birth year. ( 19th Century 1992)\n";
cin >> birthYear;
birthYear2Digits = birthYear%100;
cout << "Please enter your birth date. ( Jan15:15 )\n";
cin >> birthDate;
if ( birthYear > 1999 ){
cout << "I am sorry. " << birthYear << " is not in the 21st century.\n";
break;}//ends the case and skips to restarting
if ( birthYear < 1900 ){
cout << "I am sorry. " << birthYear << " is not in the 21st century.\n";
break;}//ends the case and skips to restarting
if ( birthDate > 31 ){//Improper Dates Of January-Excessive
cout << "I am sorry. There are not " << birthDate << " days of January.\n";
break;}//ends the case and skips to restarting
if ( birthDate < 1 ){//Improper Dates Of January-Minimal
cout << "I am sorry. January " << birthDate << "th/st does not exist.\n";
break;}//ends the case and skips to restarting
else
total = birthYear2Digits / 4;
total = total + birthYear2Digits;
total = total + birthDate;
total = total + 1;
if( birthYear%4 == 0){total=total-1;}
//switches to determine day of the week//
total = total%7;
switch( total ){
case 0:{
cout << "You were born on a Saturday.\n";
break;}
case 1:{
cout << "You were born on a Sunday!\n";
break;}
case 2:{
cout << "You were born on a Monday!\n";
break;}
case 3:{
cout << "You were born on a Tuesday!\n";
break;}
case 4:{
cout << "You were born on a Wednesday!\n";
break;}
case 5:{
cout << "You were born on a Thursday!\n";
break;}
case 6:{
cout << "You were born on a Friday!\n";
break;}
}
break;
}
//
//
case
[You must be registered and logged in to see this link.]{
cout << "Please enter your birth year. ( 19th Century 1992)\n";
cin >> birthYear;
birthYear2Digits = birthYear%100;
cout << "Please enter your birth date. ( Feb15:15 )\n";
cin >> birthDate;
if ( birthYear > 1999 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}
if ( birthYear < 1901 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}
if ( (birthDate > 28) && ( birthYear%4 != 0 ) ){//Improper Dates Of February-Excessive
cout << "I am sorry. There are not " << birthDate << " days of February. \n";
break;}
if ( birthDate < 1 ){//Improper Dates Of February-Minimal
cout << "I am sorry. February " << birthDate << "th/st does not exist. \n";
break;}//ends the case and skips to restarting
if ( birthDate > 29 ){
cout << " I am sorry. There are not " << birthDate << " days of February.\n";
break;}//ends the case and skips to restarting
else
total = birthYear2Digits / 4;
total = total + birthYear2Digits;
total = total + birthDate;
total = total+4;
if( birthYear%4 == 0){total=total-1;}
//switches to determine day of the week//
total = total%7;
switch( total ){
case 0:{
cout << "You were born on a Saturday.\n";
break;}
case 1:{
cout << "You were born on a Sunday!\n";
break;}
case 2:{
cout << "You were born on a Monday!\n";
break;}
case 3:{
cout << "You were born on a Tuesday!\n";
break;}
case 4:{
cout << "You were born on a Wednesday!\n";
break;}
case 5:{
cout << "You were born on a Thursday!\n";
break;}
case 6:{
cout << "You were born on a Friday!\n";
break;}
}
break;
}
//
//
case
[You must be registered and logged in to see this link.]{
cout << "Please enter your birth year. ( 19th Century 1992)\n";
cin >> birthYear;
birthYear2Digits = birthYear%100;
cout << "Please enter your birth date. ( Mar15:15 )\n";
cin >> birthDate;
if ( birthYear > 1999 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}//ends the case and skips to restarting
if ( birthYear < 1901 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}//ends the case and skips to restarting
if ( birthDate > 31 ){//Improper Dates Of March-Excessive
cout << "I am sorry. There are not " << birthDate << " days of March.\n";
break;}//ends the case and skips to restarting
if ( birthDate < 1 ){//Improper Dates Of March-Minimal
cout << " I am sorry. There are not " << birthDate << " days of March.\n";
break;}//ends the case and skips to restarting
else
total = birthYear2Digits / 4;
total = total + birthYear2Digits;
total = total + birthDate;
total = total+4;
//if( birthYear%4 == 0){total=total+1;}
//switches to determine day of the week//
total = total%7;
switch( total ){
case 0:{
cout << "You were born on a Saturday.\n";
break;}
case 1:{
cout << "You were born on a Sunday!\n";
break;}
case 2:{
cout << "You were born on a Monday!\n";
break;}
case 3:{
cout << "You were born on a Tuesday!\n";
break;}
case 4:{
cout << "You were born on a Wednesday!\n";
break;}
case 5:{
cout << "You were born on a Thursday!\n";
break;}
case 6:{
cout << "You were born on a Friday!\n";
break;}
}
break;
}
//
//
case
[You must be registered and logged in to see this link.]{
cout << "Please enter your birth year. ( 19th Century 1992)\n";
cin >> birthYear;
birthYear2Digits = birthYear%100;
cout << "Please enter your birth date. ( Apr15:15 )\n";
cin >> birthDate;
if ( birthYear > 1999 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}//ends the case and skips to restarting
if ( birthYear < 1901 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}//ends the case and skips to restarting
if ( birthDate > 30 ){//Improper Dates Of April-Excessive
cout << "I am sorry. There are not " << birthDate << " days of April.\n";
break;}//ends the case and skips to restarting
if ( birthDate < 1 ){//Improper Dates Of April-Minimal
cout << " I am sorry. There are not " << birthDate << " days of April.\n";
break;}//ends the case and skips to restarting
else
total = birthYear2Digits / 4;
total = total + birthYear2Digits;
total = total + birthDate;
//if( birthYear%4 == 0){total=total+1;}
//switches to determine day of the week//
total = total%7;
switch( total ){
case 0:{
cout << "You were born on a Saturday.\n";
break;}
case 1:{
cout << "You were born on a Sunday!\n";
break;}
case 2:{
cout << "You were born on a Monday!\n";
break;}
case 3:{
cout << "You were born on a Tuesday!\n";
break;}
case 4:{
cout << "You were born on a Wednesday!\n";
break;}
case 5:{
cout << "You were born on a Thursday!\n";
break;}
case 6:{
cout << "You were born on a Friday!\n";
break;}
}
break;
}
//
//
case
[You must be registered and logged in to see this link.]{
cout << "Please enter your birth year. ( 19th Century 1992)\n";
cin >> birthYear;
birthYear2Digits = birthYear%100;
cout << "Please enter your birth date. ( May15:15 )\n";
cin >> birthDate;
if ( birthYear > 1999 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}//ends the case and skips to restarting
if ( birthYear < 1901 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000. \n";
break;}//ends the case and skips to restarting
if ( birthDate > 31 ){//Improper Dates Of May-Excessive
cout << "I am sorry. There are not " << birthDate << " days of May. \n";
break;}//ends the case and skips to restarting
if ( birthDate < 1 ){//Improper Dates Of May-Minimal
cout << " I am sorry. There are not " << birthDate << " days of May. \n";
break;}//ends the case and skips to restarting
else
total = birthYear2Digits / 4;
total = total + birthYear2Digits;
total = total + birthDate;
total = total + 2;
//if( birthYear%4 == 0){total=total+1;}
//switches to determine day of the week//
total = total%7;
switch( total ){
case 0:{
cout << "You were born on a Saturday.\n";
break;}
case 1:{
cout << "You were born on a Sunday!\n";
break;}
case 2:{
cout << "You were born on a Monday!\n";
break;}
case 3:{
cout << "You were born on a Tuesday!\n";
break;}
case 4:{
cout << "You were born on a Wednesday!\n";
break;}
case 5:{
cout << "You were born on a Thursday!\n";
break;}
case 6:{
cout << "You were born on a Friday!\n";
break;}
}
break;
}
//
//
case
[You must be registered and logged in to see this link.]{
cout << "Please enter your birth year. ( 19th Century 1992)\n";
cin >> birthYear;
birthYear2Digits = birthYear%100;
cout << "Please enter your birth date. ( Jun15:15 )\n";
cin >> birthDate;
if ( birthYear > 1999 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}//ends the case and skips to restarting
if ( birthYear < 1901 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000. \n";
break;}//ends the case and skips to restarting
if ( birthDate > 30 ){//Improper Dates Of June-Excessive
cout << "I am sorry. There are not " << birthDate << " days of June. \n";
break;}//ends the case and skips to restarting
if ( birthDate < 1 ){//Improper Dates Of June-Minimal
cout << " I am sorry. There are not " << birthDate << " days of June. \n";
break;}//ends the case and skips to restarting
else
total = birthYear2Digits / 4;
total = total + birthYear2Digits;
total = total + birthDate;
total = total + 5;
//if( birthYear%4 == 0){total=total+1;}
//switches to determine day of the week//
total = total%7;
switch( total ){
case 0:{
cout << "You were born on a Saturday.\n";
break;}
case 1:{
cout << "You were born on a Sunday!\n";
break;}
case 2:{
cout << "You were born on a Monday!\n";
break;}
case 3:{
cout << "You were born on a Tuesday!\n";
break;}
case 4:{
cout << "You were born on a Wednesday!\n";
break;}
case 5:{
cout << "You were born on a Thursday!\n";
break;}
case 6:{
cout << "You were born on a Friday!\n";
break;}
}
break;
}
//
//
case
[You must be registered and logged in to see this link.]{
cout << "Please enter your birth year. ( 19th Century 1992)\n";
cin >> birthYear;
birthYear2Digits = birthYear%100;
cout << "Please enter your birth date. ( July15:15 )\n";
cin >> birthDate;
if ( birthYear > 1999 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}//ends the case and skips to restarting
if ( birthYear < 1901 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000. \n";
break;}//ends the case and skips to restarting
if ( birthDate > 31 ){//Improper Dates Of July-Excessive
cout << "I am sorry. There are not " << birthDate << " days of July. \n";
break;}//ends the case and skips to restarting
if ( birthDate < 1 ){//Improper Dates Of July-Minimal
cout << " I am sorry. There are not " << birthDate << " days of July. \n";
break;}//ends the case and skips to restarting
else
total = birthYear2Digits / 4;
total = total + birthYear2Digits;
total = total + birthDate;
//if( birthYear%4 == 0){total=total+1;}
//switches to determine day of the week//
total = total%7;
switch( total ){
case 0:{
cout << "You were born on a Saturday.\n";
break;}
case 1:{
cout << "You were born on a Sunday!\n";
break;}
case 2:{
cout << "You were born on a Monday!\n";
break;}
case 3:{
cout << "You were born on a Tuesday!\n";
break;}
case 4:{
cout << "You were born on a Wednesday!\n";
break;}
case 5:{
cout << "You were born on a Thursday!\n";
break;}
case 6:{
cout << "You were born on a Friday!\n";
break;}
}
break;
}
//
//
case
[You must be registered and logged in to see this link.]{
cout << "Please enter your birth year. ( 19th Century 1992)\n";
cin >> birthYear;
birthYear2Digits = birthYear%100;
cout << "Please enter your birth date. ( Aug15:15 )\n";
cin >> birthDate;
if ( birthYear > 1999 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}//ends the case and skips to restarting
if ( birthYear < 1901 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000. \n";
break;}//ends the case and skips to restarting
if ( birthDate > 31 ){//Improper Dates Of August-Excessive
cout << "I am sorry. There are not " << birthDate << " days of August. \n";
break;}//ends the case and skips to restarting
if ( birthDate < 1 ){//Improper Dates Of August-Minimal
cout << " I am sorry. There are not " << birthDate << " days of August. \n";
break;}//ends the case and skips to restarting
else
total = birthYear2Digits / 4;
total = total + birthYear2Digits;
total = total + birthDate;
total = total + 3;
//if( birthYear%4 == 0){total=total+1;}
//switches to determine day of the week//
total = total%7;
switch( total ){
case 0:{
cout << "You were born on a Saturday.\n";
break;}
case 1:{
cout << "You were born on a Sunday!\n";
break;}
case 2:{
cout << "You were born on a Monday!\n";
break;}
case 3:{
cout << "You were born on a Tuesday!\n";
break;}
case 4:{
cout << "You were born on a Wednesday!\n";
break;}
case 5:{
cout << "You were born on a Thursday!\n";
break;}
case 6:{
cout << "You were born on a Friday!\n";
break;}
}
break;
}
//
//
case
[You must be registered and logged in to see this link.]{
cout << "Please enter your birth year. ( 19th Century 1992)\n";
cin >> birthYear;
birthYear2Digits = birthYear%100;
cout << "Please enter your birth date. ( Sep15:15 )\n";
cin >> birthDate;
if ( birthYear > 1999 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}//ends the case and skips to restarting
if ( birthYear < 1901 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000. \n";
break;}//ends the case and skips to restarting
if ( birthDate > 30 ){//Improper Dates Of September-Excessive
cout << "I am sorry. There are not " << birthDate << " days of September. \n";
break;}//ends the case and skips to restarting
if ( birthDate < 1 ){//Improper Dates Of September-Minimal
cout << " I am sorry. There are not " << birthDate << " days of September. \n";
break;}//ends the case and skips to restarting
else
total = birthYear2Digits / 4;
total = total + birthYear2Digits;
total = total + birthDate;
total = total + 6;
//if( birthYear%4 == 0){total=total+1;}
//switches to determine day of the week//
total = total%7;
switch( total ){
case 0:{
cout << "You were born on a Saturday.\n";
break;}
case 1:{
cout << "You were born on a Sunday!\n";
break;}
case 2:{
cout << "You were born on a Monday!\n";
break;}
case 3:{
cout << "You were born on a Tuesday!\n";
break;}
case 4:{
cout << "You were born on a Wednesday!\n";
break;}
case 5:{
cout << "You were born on a Thursday!\n";
break;}
case 6:{
cout << "You were born on a Friday!\n";
break;}
}
break;
}
//
//
case
[You must be registered and logged in to see this link.]{
cout << "Please enter your birth year. ( 19th Century 1992)\n";
cin >> birthYear;
birthYear2Digits = birthYear%100;
cout << "Please enter your birth date. ( Oct15:15 )\n";
cin >> birthDate;
if ( birthYear > 1999 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}//ends the case and skips to restarting
if ( birthYear < 1901 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000. \n";
break;}//ends the case and skips to restarting
if ( birthDate > 31 ){//Improper Dates Of October-Excessive
cout << "I am sorry. There are not " << birthDate << " days of October. \n";
break;}//ends the case and skips to restarting
if ( birthDate < 1 ){//Improper Dates Of October-Minimal
cout << " I am sorry. There are not " << birthDate << " days of October. \n";
break;}//ends the case and skips to restarting
else
total = birthYear2Digits / 4;
total = total + birthYear2Digits;
total = total + birthDate;
total = total + 1;
//if( birthYear%4 == 0){total=total+1;}
//switches to determine day of the week//
total = total%7;
switch( total ){
case 0:{
cout << "You were born on a Saturday.\n";
break;}
case 1:{
cout << "You were born on a Sunday!\n";
break;}
case 2:{
cout << "You were born on a Monday!\n";
break;}
case 3:{
cout << "You were born on a Tuesday!\n";
break;}
case 4:{
cout << "You were born on a Wednesday!\n";
break;}
case 5:{
cout << "You were born on a Thursday!\n";
break;}
case 6:{
cout << "You were born on a Friday!\n";
break;}
}
break;
}
//
//
case
[You must be registered and logged in to see this link.]{
cout << "Please enter your birth year. ( 19th Century 1992)\n";
cin >> birthYear;
birthYear2Digits = birthYear%100;
cout << "Please enter your birth date. ( Nov15:15 )\n";
cin >> birthDate;
if ( birthYear > 1999 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}//ends the case and skips to restarting
if ( birthYear < 1901 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000. \n";
break;}//ends the case and skips to restarting
if ( birthDate > 30 ){//Improper Dates Of November-Excessive
cout << "I am sorry. There are not " << birthDate << " days of November. \n";
break;}//ends the case and skips to restarting
if ( birthDate < 1 ){//Improper Dates Of November-Minimal
cout << " I am sorry. There are not " << birthDate << " days of November. \n";
break;}//ends the case and skips to restarting
else
total = birthYear2Digits / 4;
total = total + birthYear2Digits;
total = total + birthDate;
total = total + 4;
//if( birthYear%4 == 0){total=total+1;}
//switches to determine day of the week//
total = total%7;
switch( total ){
case 0:{
cout << "You were born on a Saturday.\n";
break;}
case 1:{
cout << "You were born on a Sunday!\n";
break;}
case 2:{
cout << "You were born on a Monday!\n";
break;}
case 3:{
cout << "You were born on a Tuesday!\n";
break;}
case 4:{
cout << "You were born on a Wednesday!\n";
break;}
case 5:{
cout << "You were born on a Thursday!\n";
break;}
case 6:{
cout << "You were born on a Friday!\n";
break;}
}
break;
}
//
//
case
[You must be registered and logged in to see this link.]{
cout << "Please enter your birth year. ( 19th Century 1992)\n";
cin >> birthYear;
birthYear2Digits = birthYear%100;
cout << "Please enter your birth date. ( Dec15:15 )\n";
cin >> birthDate;
if ( birthYear > 1999 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000.\n";
break;}//ends the case and skips to restarting
if ( birthYear < 1901 ){
cout << "I am sorry. Please enter a year BETWEEN 1900 and 2000. \n";
break;}//ends the case and skips to restarting
if ( birthDate > 30 ){//Improper Dates Of December-Excessive
cout << "I am sorry. There are not " << birthDate << " days of December. \n";
break;}//ends the case and skips to restarting
if ( birthDate < 1 ){//Improper Dates Of December-Minimal
cout << " I am sorry. There are not " << birthDate << " days of December. \n";
break;}//ends the case and skips to restarting
else
total = birthYear2Digits / 4;
total = total + birthYear2Digits;
total = total + birthDate;
total = total + 6;
//if( birthYear%4 == 0){total=total+1;}
//switches to determine day of the week//
total = total%7;
switch( total ){
case 0:{
cout << "You were born on a Saturday.\n";
break;}
case 1:{
cout << "You were born on a Sunday!\n";
break;}
case 2:{
cout << "You were born on a Monday!\n";
break;}
case 3:{
cout << "You were born on a Tuesday!\n";
break;}
case 4:{
cout << "You were born on a Wednesday!\n";
break;}
case 5:{
cout << "You were born on a Thursday!\n";
break;}
case 6:{
cout << "You were born on a Friday!\n";
break;}
}
break;
}
//
[You must be registered and logged in to see this link.] month
{
cout << "I am sorry. That is not a valid month.\n";
break;
}
/**********************/}//closes switch
cout << "Press Y to Continue/Restart\n";
cin >> continueYN;
if ( continueYN == 'Y' ){
system ("CLS");}
}while(continueYN=='Y');//closes do loop
return 0;
}
int all_in_one_Program()
{
int integer = 0;
double doubleVar = 0.0;
float floatVar = 0.0;
apstring apstringVar;
char character = 'a';
int clearScreen = 0;
int counter = 0;
int loopAmount = 0;
cout << "Please enter a variable \n[You are about to take in an 'int' variable]\n";
cin >> integer;
cout << "Please enter a double variable \n";
cin >> doubleVar;
cout << "Please enter a float variable \n";
cin >> floatVar;
cout << "Please enter an apstring variable \n";
cin >> apstringVar;
cout << "Please enter a character \n";
cin >> character;
cout << "Your "int" is " << integer << endl;
cout << "Your "double" is " << doubleVar << endl;
cout << "Your "float" is " << floatVar << endl;
cout << "Your "apstring" is " << apstringVar << endl;
cout << "Your "character" is " << character << endl;
cout << "We are about to perform a "for loop". How many times would you like it to loop?\n";
cin >> loopAmount;
counter = 0;
for (counter = 0; counter < loopAmount; counter++)
{
cout << "The "for loop" has run " << counter << " time[s] \n";
}
return 0;
}