@LoganDark/

AncientLovingStacks

C++

No description

fork
loading
Files
  • main.cpp
  • little-big-int
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <string>
#include <sstream>
#include "little-big-int/little-big-int.hpp"

void getInput(std::string &str) {
	std::getline(std::cin, str);
}

int main() {
	std::string input;
	BigUint num;

	while (true) {
		std::cout << "Number #";
		getInput(input);

		try {
			num = BigUint(input.c_str());
		} catch (std::invalid_argument) {
			std::cout << "Please enter a valid integer" << std::endl;

			continue;
		}

		break;
	}

	BigUint multiplier;

	while (true) {
		std::cout << "Multiplier #";
		getInput(input);

		try {
			multiplier = BigUint(input.c_str());
		} catch (std::invalid_argument) {
			std::cout << "Please enter a valid integer" << std::endl;

			continue;
		}

		break;
	}

	std::cout << num.str() << " multiplied by " << multiplier << " is " << num * multiplier << std::endl;
}