Code by Kevin (Answer to the task)

Hello dear @ben and Community,

int main()
{
	PrintIntro();

	constexpr int maxLoop = 5;

	for (size_t i = 0; i < maxLoop; i++) {
		GetGuessAndPrintBack();
	}

	return 0;
}

BTW: What is “size_t”?

Kind regards
Kevin

So basically size_t is an unsigned (only positive numbers), integral value that is typically used to represent the size or length of objects, which is a fancy way of saying that the size_t will change its size based on the system, so for 32-bit applications, size_t will typically be a 32 bit unsigned integer and 64-bit app, it will be 64 bit unsigned integer so the size of it depends on your system .
It is guaranteed to be big enough to contain the size of the biggest object that system can handle.

A good explanation can be found here

	std::cout << sizeof(int) << endl;
	std::cout << sizeof(size_t) << endl;
1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms