60 608
Assignments Done
97,8%
Successfully Done
In April 2018

Answer to Question #15725 in C++ for Abdul G

Question #15725
I want to display one when user press 1 if 2 then cout two and if press 3 then output will b three and this program run upto 100
Expert's answer
#include <string>
#include <iostream>
using namespace std;


int main()
{
int b,i,a,z;
cout<<"Eenter integer:& ";
cin>>b;
string m[31];
m[1]="one";
m[2]="two";
m[3]="three";
m[4]="four";
m[5]="five";
m[6]="six";
m[7]="seven";
m[8]="eight";
m[9]="nine";
m[10]="ten";
m[11]="eleven";
m[12]="twelve";
m[13]="thirteen";
m[14]="fourteen";
m[15]="fifteen";
m[16]="sixteen";
m[17]="seventeen";
m[18]="eighteen";
m[19]="nineteen";
m[20]="twenty ";
m[22]="twenty ";
m[23]="thirty ";
m[24]="forty ";
m[25]="fifty ";
m[26]="sixty ";
m[27]="seventy ";
m[28]="eighty ";
m[29]="ninety ";
m[30]="hundred ";
a=b%10;
z=(b-a)/10;
if(z>1 && z<11)
cout<<m[20+z];

if(a>0 && (z>1 ||z<1))
& cout<<m[a]<<"\n";
&
&
& if(z>0 && z<2)
& cout<<m[10+a];
&
cout<<"\n\n";
system("PAUSE");
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions