subject
Computers and Technology, 07.05.2021 16:50 pluto82

IN C++. My code here is written to write a two-digit number in words, everything works as intended except when I enter the number 10-19, it will do what it is supposed to but then print the word for a number in the 20s. It would be greatly appreciated if you could take a look at the code. ```
#include
#include
#include
using namespace std;
int main() {

int number, first, second;

cout<<"Enter a two digit number:";
cin>>number;

first=floor(number/10);
second=floor(number%10);

switch(first){
case 1: switch(second){
case 0:cout<<"The number entered is ten";break; return 0;
case 1:cout<<"The number entered is eleven";break; return 0;
case 2:cout<<"The number entered is twelve";break; return 0;
case 3:cout<<"The number entered is thirteen";break; return 0;
case 4:cout<<"The number entered is fourteen";break; return 0;
case 5:cout<<"The number entered is fifteen";break; return 0;
case 6:cout<<"The number entered is sixteen";break; return 0;
case 7:cout<<"The number entered is seventeen";break; return 0;
case 8:cout<<"The number entered is eighteen";break; return 0;
case 9:cout<<"The number entered is ninteen";break; return 0;
}
case 2:cout<<"The number entered is twenty";break;
case 3:cout<<"The number entered is thirty";break;
case 4:cout<<"The number entered is fourty";break;
case 5:cout<<"The number entered is fifty";break;
case 6:cout<<"The number entered is sixty";break;
case 7:cout<<"The number entered is seventy";break;
case 8:cout<<"The number entered is eighty";break;
case 9:cout<<"The number entered is nintey";break;
}
switch(second) {
case 0: break;
case 1:cout<<"-one";break;
case 2:cout<<"-two";break;
case 3:cout<<"-three";break;
case 4:cout<<"-four";break;
case 5:cout<<"-five";break;
case 6:cout<<"-six";break;
case 7:cout<<"-seven";break;
case 8:cout<<"-eight";break;
case 9:cout<<"-nine";break;
}

return 0;
}
```

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:30
To increase sales, robert sends out a newsletter to his customers each month, letting them know about new products and ways in which to use them. in order to protect his customers' privacy, he uses this field when addressing his e-mail. attach bcc forward to
Answers: 2
question
Computers and Technology, 23.06.2019 12:00
3. when you right-click a linked spreadsheet object, what commands do you choose to activate the excel features? a. linked worksheet object > edit b. edit data > edit data c. linked spreadsheet > edit d. object > edit data
Answers: 2
question
Computers and Technology, 23.06.2019 16:00
An english teacher would like to divide 8 boys and 10 girls into groups, each with the same combination of boys and girls and nobody left out. what is the greatest number of groups that can be formed?
Answers: 2
question
Computers and Technology, 23.06.2019 22:30
Jamie has to enter the names, employee id’s, and income of a group of employees into a worksheet. which option will jamie use to describe the data
Answers: 3
You know the right answer?
IN C++. My code here is written to write a two-digit number in words, everything works as intended e...
Questions
question
Mathematics, 03.02.2021 17:30
question
Mathematics, 03.02.2021 17:30
question
Mathematics, 03.02.2021 17:30
question
English, 03.02.2021 17:30
Questions on the website: 13722367