Public feed #727490

yes

public cpp v1 · immutable
Raw Edit
·published 2007-10-06 02:01 UTC
rendered paste body
// Josh Doten// 10-5-07// Amendment Quiz#include <iostream>#include <string>#include <time.h>#include <math.h>#include <iomanip>using namespace std;int main (){	srand(time(NULL));    int random;    int guess;    int right;    int total;    int grade;        guess = 5;    right = 0;    total = 0;            cout << "INSTRUCTIONS: Enter the number of the amendment that goes with each definition. Enter \"0\" for the amendment if you would like to quit.\n\n";            while ( guess != 0 )    {    		random = (rand()%(26))+2;                    if (random == 1)          {                     cout << "Congress may not violate the rights of freedom of religion, speech, press, peaceable assemply, and petition."                          << "\nAmendment: ";          }          if (random == 2)          {          cout << "Each state has the right to maintain a milita. Individuals can own and use weapons."                          << "\nAmendment: ";          }          if (random == 3)          {                     cout << "The government may not quarter, or house, silders in people's homes during peacetime without the people's permission."                          << "\nAmendment: ";          }          if (random == 4)          {          cout << "The government may not search or take a person's property without a warrant. "                          << "\nAmendment: ";          }          if (random == 5)          {          cout << "A person may not be tried twice for the same crime and does not have to testify against him/herself. "                          << "\nAmendment: ";          }          if (random == 6)          {          cout << "A person charged with a crime has the right to a speedy trial, an impartial jury, and a lawyer. "                          << "\nAmendment: ";          }          if (random == 7)          {          cout << "A person in a civil case is guarenteed a trial by jury. "                          << "\nAmendment: ";          }          if (random == 8)          {          cout << "A person is protected from excessive or unreasonable fines or cruel and unusual punishment. "                          << "\nAmendment: ";          }          if (random == 9)          {          cout << "The people have rights others than those mentioned in the Constitution. "                          << "\nAmendment: ";          }          if (random == 10)          {          cout << "Any power not given to the Federal Government by the Constitution is a power of either the State or the people."                          << "\nAmendment: ";          }          if (random == 11)          {          cout << "Citizens of a State or foreign country may not sue another State in federal court. "                          << "\nAmendment: ";          }          if (random == 12)          {          cout << "The Electoral College will vote separately for the President and Vice President rather than together on one ballot. "                          << "\nAmendment: ";          }          if (random == 13)          {          cout << "Slavery is outlawed in the United States. "                          << "\nAmendment: ";          }          if (random == 14)          {          cout << "States shal not deprive persons of life, liberty, or property without due process. The Three-Fifths Compromise is repealed, and all persons are counted in the census. "                          << "\nAmendment: ";          }          if (random == 15)          {          cout << "Citizens are guarenteed the right to vote, regardless of race, color, or status of former slave. "                          << "\nAmendment: ";          }          if (random == 16)          {          cout << "Congress has the right to set up an income tax. "                          << "\nAmendment: ";          }          if (random == 17)          {          cout << "U.S. Senators are elected directly by voters in each State. "                          << "\nAmendment: ";          }          if (random == 18)          {          cout << "Making or selling alcohol is illegal. "                          << "\nAmendment: ";          }          if (random == 19)          {          cout << "Citizens are guaranteed the right to vote, regardless of sex. "                          << "\nAmendment: ";          }          if (random == 20)          {          cout << "The President takes office on January 20, and Congress's term begins January 3. "                          << "\nAmendment: ";          }          if (random == 21)          {          cout << "This amendment repealed the 18th Amendment. "                          << "\nAmendment: ";          }          if (random == 22)          {          cout << "No President can be elected to more than two terms. "                          << "\nAmendment: ";          }          if (random == 23)          {          cout << "People living in Washington D.C., may vote in presidential and vice presidental elections. D. C. has three presidental electors. "                          << "\nAmendment: ";          }          if (random == 24)          {          cout << "People may vote for President, Vice President, and Congress without paying a voting tax. "                          << "\nAmendment: ";          }          if (random == 25)          {          cout << "The Vice President becomes the President if the President is disabled. "                          << "\nAmendment: ";          }          if (random == 26)          {          cout << "Citizens who are at least 18 years of age are guaranteed the right to vote. "                          << "\nAmendment: ";          }          if (random == 27)          {          cout << "Any pay raise the House of Representatives may approve for its members does not take effect until after the nexct congressional election. "                          << "\nAmendment: ";          }                    cin >> guess;                    while ( guess < 0 || guess > 27)          {                cout << "\nYou have entered an invalid Amendment Number. Please enter the amendment number again: ";                cin >> guess;          }                    if (guess == random)          {                    cout << "\nCorrect!";                    system ("PAUSE");                    right = right + 1;                    total = total + 1;          }          else          {                    if ( guess == 0)                    {                                         // stops the retarded computer from yelling at you!                    }                    else                    {                               cout << "\nIncorrect. The Correct answer was"                                    << random                                    << ".";                               total = total + 1;                               system ("PAUSE");                     }          }              }                    grade = (right / total) * 100;                    cout << "\n\nYou got "               << right               << " right out of "               << total               << "questions. \n That is a "               << grade               << "%";                         system ("PAUSE");                    return 0;}