This program takes 2 ints (a
and b
) and is supposed to print their product.
It terminates without printing the last line, though:
Problem:what makes the program doesn´t give the result that u want and closes beforehand ? is there something wrong with this line?
std::cout << "Product of entered numbers = " << c << std::endl;
// first program, printing chars and multiplying 2 integers
#include <iostream>
int main()
{
printf("Characters: %c %c \n", 'a', 65);
printf("Decimals: %d %ld\n", 1977, 650000L);
printf("Preceding with blanks: %10d \n", 1977);
printf("Preceding with zeros: %010d \n", 1977);
printf("Some different radices: %d %x %o %#x %#o \n", 100, 100, 100, 100, 100);
printf("floats: %4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416);
printf("Width trick: %*d \n", 5, 10);
printf("%s \n", "A string");
int a, b, c;
std::cout << "Enter two numbers to multiply\n";
std::cin >> a >> b;
c = a*b;
std::cout << "Product of entered numbers = " << c << std::endl;
return 0;
}