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 11:30
Andrina writes letters that are regularly sent to hundreds of her company’s customers. because of this, she would like for the mail merge command to be in her quick access toolbar, and she wants it to be the first button on the left. what should andrina do to place the mail merge button there?
Answers: 1
question
Computers and Technology, 22.06.2019 19:20
Write a program that prompts the user to input a string. the program then uses the function substr to remove all the vowels from the string. for example, if str = "there", then after removing all the vowels, str = "thr". after removing all the vowels, output the string. your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel.
Answers: 2
question
Computers and Technology, 24.06.2019 18:20
Acommon algorithm for converting a decimal number to binary is to repeatedly divide the decimal number by 2 and save the remainder. this division is continued until the result is zero. then, each of the remainders that have been saved are used to construct the binary number.write a recursive java method that implements this algorithm.it will accept a value of int and return a string with the appropriate binary character representation of the decimal number.my code: public class lab16{public string converttobinary(int input){int a; if(input > 0){a = input % 2; return (converttobinary(input / 2) + "" +a); } return ""; } }
Answers: 1
question
Computers and Technology, 25.06.2019 02:30
How to delete a question in
Answers: 2
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
Questions on the website: 13722363