All pastes #589739 Raw Edit

nestedif

public cpp v1 · immutable
#589739 ·published 2007-06-26 04:48 UTC
rendered paste body
/* All I want is for it to start over again if they press 1 and to exit if they press 2 */#include <iostream>int main(){      int firstNumber, secondNumber, yesOrno = 1;      while(yesOrno == 1)      {            std::cout << "\nEnter two numbers.\nFirst: ";            std::cin >> firstNumber;            std::cout << "Second: ";            std::cin >> secondNumber;            std::cout << "\n\n";                  if (firstNumber >= secondNumber)            {                  if ( (firstNumber % secondNumber) == 0)                   {                        if (firstNumber == secondNumber)                        {                              std::cout << "They are the same!\n";                        }                        else                        {                              std::cout << "They are evenly divisible!\n";                        }                  }                  else                  {                        std::cout << "They are not evenly divisible!\n";                  }            }            else            {                  std::cout << "Hey! The second one is larger!\n";            }                  std::cout << "Would you like to play again?\nYes = 1 and No = 2\n";            std::cin >> yesOrno;            if (yesOrno == 1)            {                  std::cout << "Ok you can keep on playing!\n";            }      }      return 0;}