subject

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
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;
case 1:cout<<"The number entered is eleven";break;
case 2:cout<<"The number entered is twelve";break;
case 3:cout<<"The number entered is thirteen";break;
case 4:cout<<"The number entered is fourteen";break;
case 5:cout<<"The number entered is fifteen";break;
case 6:cout<<"The number entered is sixteen";break;
case 7:cout<<"The number entered is seventeen";break;
case 8:cout<<"The number entered is eighteen";break;
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: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 08:00
What is a scenario where records stored in a computer frequently need to be checked
Answers: 2
question
Computers and Technology, 24.06.2019 17:30
Click on the tab on the ribbon to open the backstage view. file view insert review
Answers: 1
question
Computers and Technology, 25.06.2019 00:00
He computer component that disperses heat from the microprocessor to the cooling fan is a cooler thermometer heat sink
Answers: 1
question
Computers and Technology, 25.06.2019 05:10
Assume that two parallel arrays have been declared and initialized: healthoption an array of type char that contains letter codes for different healthcare options and annual cost an array of type int. the i-th element of annual cost indicates the annual cost of the i-th element of healthoption. in addition, there is an char variable, best2.write the code necessary to assign to best2 the health option with the lower annual cost, considering only the first two healthcare options. thus, if the values of healthoption are 'b', 'q', 'w', 'z' and the values of annualcost are 8430, 9400, 7050, 6400 your code would assign 'b' to best2 because 8430 is less than 9400 and is associated with 'b' in the parallel array. (we ignore 'w' and 'z' because we are considering only the first two options.)
Answers: 1
You know the right answer?
My code here is written to write a two-digit number in words, everything works as intended except wh...
Questions
question
Mathematics, 06.03.2020 20:27
Questions on the website: 13722363