### Introductory Level - Switch Statements and Cases

I am at the beginning stages of earning my Bachelors in Computer Science. Unfortunately, I missed my second lab due to a snowstorm, and I am struggling to figure this out on my own. Before jumping to conclusions, I am not asking anyone to do my homework. I am not asking for a complete answer, and trust me - I know I need to learn this all for myself. Below I will post the instructions for my assignment.

 Number Spell Create a project Lab2_NumberSpell. Write a program that inputs a two-digit natural number (from 0 1 to 9 9) and outputs this number spelled out in English. That is, for 2 3 it outputs twenty three. For 0 6, it should output six. You may assume that the two numbers to be input are separated by space. You are not allowed to use the concepts, such as looping or functions that we have not studied. Writing a program that treats all 99 cases separately (that is, has 99 separate output statements) will result in a bad grade. Hint: input the numbers as two variables of type int, then create output using several switch and if statements. Specifically, you will need to differentiate (with an if) a number that is less than 20. For such numbers you will need a switch statement to print the whole value. For the numbers larger than 20, you will need one switch to print the word for the first digit, and another -- the word for the second digit. That is, the outline of your program could be as follows: if(first number is equal to 1) switch that recognizes the second character (second digit) and prints the whole number "ten", "eleven", or ... else switch that recognizes the first digit and prints "twenty" or "thirty", or ... note that this switch should ignore the case (print nothing) if the first digit is zero after that switch that recognizes the second digit and prints "one" or "two", or ... note that this switch should also ignore the case of zero

I am at such an elementary level. I understand what I am asked to do, but I do not understand how many variables I will need, and where to place them. Am I on the right path?

#include <iostream>
using namespace std;

int main() {

int first_number, second_number, english_word; // natural numbers
cout << "Enter a number between 0 and 99: ";
cin >> first_number >> second_number;

if (first_number == 1)
switch (second_number){

case 1:
cout << "Eleven ";
second_number = 1;
break;
Again, I know this is mind-blowingly elementary to you programmers out there - but to me this is a foreign language.
Thanks,

My code seems to be working, but another question - how do I write it so that the switch ignores the case of 0? For example, "07" should be read as Seven, and the first digit should be ignored.
Topic archived. No new replies allowed.