math program

Im trying to write a program to allow a grade to be entered then present a math problem of varying difficulty. The higher the grade the harder the problems are. First grade is only addition, but second is addition and subtraction. I am completely spacing on how to set up my code to make the number being subtracted from be on top.

#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <cmath>
using namespace std;

string name;
int grade;
double a, b, c;
double userAnswer;

int main()
unsigned seed = time(0);

cout <<"Welcome to the Math Tutor\n\n";

cout <<"Enter your name: ";
getline(cin, name);
cout <<"Enter your grade: ";
cin >> grade;

cout <<"\nPlease answer the following problem "<< name <<".\n"<< endl;

if(grade == 1){
a = rand() % 10;
b = rand() % 10;
c = a + b;
cout <<"Problem: ";
cout << right << setw(5);
cout << a << endl;
cout << right << setw(13);
cout <<"+ " << b << endl;
cout << right << setw(14);
cout <<"----"<< endl;
cout << left;
cout <<"Answer: ";
cin >> userAnswer;
else if (grade == 2) {
a = rand() % 89 + 10;
a = rand() % 89 + 10;}


Here is my code so far. I havent completed the second if yet because I dont know how to word it. Yes, this is a homework assignment, but I am not looking for a complete solution, only a push in the right direction. Like i said i need to allow for either addition or subtraction with the higher number being above the lower. Am i right in using if statements? Or should I be using switch or some other function? New to programming this semester, and our teacher is not very good. Thanks for any help you can give.
Topic archived. No new replies allowed.