C please explain also
Write a program that will ask the user to continuously enter a number until such time that the entered value is not a number. #include <iostream> #include <iomanip> using namespace std; int main(){ int number; int sum = 0; int product = 1; int loopcount = 0; int totalnum = 0; std:: cout << "Enter total of numbers you want to add or multiply" <<endl; std:: cin>> std::setw(1) >> totalnum; std::cin.clear(); std:: cout<< "Enter"<<totalnum<< "numbers to add or multiply: " << endl; while (loopcount < totalnum){ std::cout << "Input a number or 'x' to stop: " << endl; std::cin>> std::setw(1)>> number; std::cin.ignore(); std::cin.clear(); sum+= number; product*= number; loopcount= loopcount + 1; if ( !( cin >> std::setw(1)>> number ) ) {break;} std::cin.clear(); std::cin.ignore(INT_MAX, '\n'); } std:: cout<<"The sum is :" <<sum<<endl; std:: cout<<"The product is :" <<product<<endl; return 0; } I have run this code it reads