Numeral Datatypes

Numeral data types (int, float, double)

Write a program that declares three variables: myInt, myFloat, and myDouble. Assign values to these variables and then print them out in one line seperated by commas.

42, 3.14, 2.71828

Answer

#include <iostream>

int main() {
	int myInt = 42;
	float myFloat = 3.14f;
	double myDouble = 2.71828;

	std::cout << myInt << ", " << myFloat << ", " << myDouble;
}
Questions