I am trying to make a code so if the answer is less than 10 or more than 10 it says "wrong answer" I just testing somethings right now I'm very new to coding. right now I have:
#include <iostream>
#include "log.h"
int main()
{
MultiplyAndLog2(5, 2); // this is what is going to be multiplied
int x = 11;
if (x == 10) // I have it so I if it equal to 10 it says right answer
Log("right answer");
if (x == ) // Heres where im stuck I dont know what to add if any number other than 10 is the answer
Log("wrong answer");
std::cin.get();
}
Heres my log.h its a bit messy...
#pragma once
int Multiply(int a, int b, int c) // this is so I can multiply 3 integers at a time just for testing.
{
return a * b * c;
}
int Multiply(int a, int b) // this is the same thing but for 2 integers at a time
{
return a * b;
}
void MultiplyAndLog(int a, int b, int c) // this is so that whatever 3 integers are multiplied it would say answer: and then the answer to the question
{
int result = Multiply(a, b, c);
std::cout << "answer:" << result << std::endl;
}
void MultiplyAndLog2(int a, int b) // this is so that is 2 integers are multiplied it would say answer: and then the answer to the question
{
int result = Multiply(a, b);
std::cout << "answer:" << result << std::endl;
}
void Log(const char* message) // This is so if I type Log I can write whatever I want for example "right answer"
{
std::cout << message << std::endl;
}
Thank you, Mario
Aucun commentaire:
Enregistrer un commentaire