#include "stdafx.h"
#include <iostream>
usingnamespace std;
int main()
{
int x,y,z,a,b,i;
y = 2;
z = 4;
a = 6;
b = 8;
i = 0;
int pattern = 0;
char response;
int sum;
cout << "What is the following pattern?" << endl;
cout << "y: " << y << endl;
cout << "z: " << z << endl;
cout << "a: " << a << endl;
cout << "b: " << b << endl;
cout << "i: ?" << endl;
while (pattern != 2)
{
cout << "The pattern is: ";
cin >> pattern;
if (pattern != 2)
cout << "Wrong, try again.\n";
elsebreak;
}
cout << "Good job, it is 2!" << endl;
cout << "If the pattern continues, the variable i should equal: ";
cin >> i;
while (i != 10)
{
cout << "Incorrect, try again.\n";
cout << "The variable i should equal: ";
cin >> i;
}
cin.ignore();
cout << "Correct, good job!" << endl;
cout << " Now your ready for some addition right.....Y or N?";
cin >> response;
if (response == 'Y')
{
cout << " Great! What is a + b?" << endl;
cin >> sum;
while (sum != 14)
cout << " Incorrect Try again! ";
break;
}
elseif (response == 'N')
{
cout << " You suck! close my program!";
cin.get();
cin.get();
}
I'm trying to make it so if you say Y you answer a math question but I don't know how to go about it.