Question: A program that can count from 1 to 100 in mandarin, while also displaying the number on the left side. Error: It prints out 20,

A program that can count from 1 to 100 in mandarin, while also displaying the number on the left side. Error: It prints out 20, 30, 40... as 29, 39, 49.... How can i fix this? Code in C++. Can use loops and if statements. #include using namespace std; int main() { int num1 = 0; int num2 = 0; int num3 = 0; string ones, tens; cout << "Please enter a number that you want to count up to in Mandariin. "; cin >> num1; cout << "Please enter what number to start with: "; cin >> num2; cout << "What step size do you want to use? "; cin >> num3; for (int i = num2; i <= num1; i += num3) { if (i == 0) ones = "ling"; if (i % 10 == 1) ones = "yi"; if (i % 10 == 2) ones = "er"; if (i % 10 == 3) ones = "san"; if (i % 10 == 4) ones = "si"; if (i % 10 == 5) ones = "wu"; if (i % 10 == 6) ones = "liu"; if (i % 10 == 7) ones = "qi"; if (i % 10 == 8) ones = "ba"; if (i % 10 == 9) ones = "jiu"; if (i / 10 == 1) { tens = "shi"; } if (i / 10 == 2) { tens = "er shi"; } if (i / 10 == 3) { tens = "san shi"; } if (i / 10 == 4) { tens = "si shi"; } if (i / 10 == 5) { tens = "wu shi"; } if (i / 10 == 6) { tens = "liu shi"; } if (i / 10 == 7) { tens = "qi shi"; } if (i / 10 == 8) { tens = "ba shi"; } if (i / 10 == 9) { tens = "jiu shi"; } cout << i << " " << tens << " " << ones << endl; }

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!