|
Java Help
I am not sure if I am in the right forum but I am writing a code in Java to produce random multiplication. I wrote it in C++ but I am kinda new to Java. Can anyone help me translate this program that I wrote in c++ to Java.
using std::cin;
using std::endl;
void multiplication();
int main()
{
multiplication();
return 0;
}
void multiplication()
{
int x;
int y;
int response = 0;
while ( response != -1 ) {
x = rand() % 10;
y = rand() % 10;
cout << " How much is " << x << " times " << y
<< " ( -1 to End ) ? : ";
cin >> response;
while ( response != -1 && response != x * y ) {
cout << " No. Please try again: " ;
cin >> response;
} //End While
if ( response != -1)
cout << "Very Good!\n\n";
} //End while
} // End function multiplication
|