Write a program that works in the same fashion as a message composer in the old mobiles.

The program must receive integer input. When use enter 2 the program outputs letter ‘A’ and if 2 is pressed twice, the letter ‘A’ will disappear from screen and character ‘B’ will appear and if 2 is pressed thrice the letter ‘B’ will disappear and Letter C will appear. To enter ‘AA’ you have to enter number ‘2’ twice with delay. Delay must be as smaller as it is usually in the mobile.

Write a program that input a number like below and converts it into string. 28444333# The program will output ATIF If you have to print “AAA” then input will be 212121# where 1 is used as separator. # will be used as input terminator. Program Requirement. You have to use on those programming elements discussed in the class so far. You cannot use string and character array. Only primitive data types are allowed.

I've made a program as following but my assignment requires delay and some other things which I'm not able to do.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
  using namespace std;

#include <iostream>
#include <conio.h>
#include <stdlib.h>

int main(){
    int x;
    while (2){
        cin >> x;
        switch(x){

    case 2:
        {
            cout << "A\n";
    break;
        }
    case 22:
        {
            cout << "B\n";
    break;
        }
    case 222:
        {
            cout << "C\n";
    break;

        }
        case 3:
        {
            cout << "D\n";
    break;
        }
    case 33:
        {
            cout << "E\n";
    break;
        }
    case 333:
        {
            cout << "F\n";
    break;
        }
        case 4:
        {
            cout << "G\n";
    break;
        }
    case 44:
        {
            cout << "H\n";
    break;
        }
    case 444:
        {
            cout << "I\n";
    break;
        }
        case 5:
        {
            cout << "J\n";
    break;
        }
    case 55:
        {
            cout << "K\n";
    break;
        }
    case 555:
        {
            cout << "L\n";
    break;
        }
        case 6:
        {
            cout << "M\n";
    break;
        }
    case 66:
        {
            cout << "N\n";
    break;
        }
    case 666:
        {
            cout << "O\n";
    break;
        }
    case 7:
        {
            cout << "P\n";
    break;
        }
    case 77:
        {
            cout << "Q\n";
    break;
        }
    case 777:
        {
            cout << "R\n";
    break;
        }
    case 7777:
        {
            cout << "S\n";
        }
    break;
    case 8:
        {
            cout << "T\n";
    break;
        }
    case 88:
        {
            cout << "U\n";
    break;
        }
    case 888:
        {
            cout << "V\n";
    break;
        }
    case 9:
        {
            cout << "W\n";
    break;
        }
    case 99:
        {
            cout << "X\n";
    break;
        }
    case 999:
        {
            cout << "Y\n";
    break;
        }
    case 9999:
        {
            cout << "Z\n";
        }
    break;
    case 0:
        {
            cout << " \n";
        }
    break;
    case 1:
        {
            cout << ".\n";
        }
    break;
    }
}
}
Topic archived. No new replies allowed.