ödevömer
unknown
c_cpp
3 years ago
1.1 kB
5
Indexable
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
bool CheckInput(string input, string &firstNum, string &secondNum)
{
bool foundOperator = false;
int equalityPos = input.find("=");
for (int i = 1; i < equalityPos; i++)
{
if (input[i] == '+' || input[i] == '-')
{
firstNum = input.substr(0, i);
secondNum = input.substr(i, equalityPos);
foundOperator = true;
break;
}
}
if (foundOperator == false)
{
return false;
}
return true;
}
bool CalculateAnswer()
{
return 0;
}
int ParseMath()
{
return 0;
}
string AskQuestion(string &input, int questionCount)
{
cout << "Please enter question #"<< questionCount << " and its answer: ";
cin >> input;
}
int main()
{
int questionCount = 0;
int maxQuestionCount = 4;
bool jokerAvailable = true;
string firstNum, secondNum, input;
AskQuestion(input, questionCount);
if (!CheckInput(input, firstNum, secondNum))
{
cout << "Wrong input format! You got -10 penalty points for this math expression." << endl;
questionCount++;
}
return 0;
}Editor is loading...