1
0
LearningCPP/utils.cpp

20 lines
472 B
C++

#include <iostream>
namespace utils
{
int promptNumber(const char* prompt)
{
int toReturn {};
std::cout << prompt;
std::cin >> toReturn;
return toReturn;
}
void addSubTwoNumbers()
{
int num1 {promptNumber("Enter a integer: ")};
int num2 {promptNumber("Enter another integer: ")};
std::cout << num1 << " + " << num2 << " = " << num1 + num2 << "\n";
std::cout << num1 << " - " << num2 << " = " << num1 - num2 << "\n";
}
}