ans???

input digit and print it in words??
Yes?
plz give me it's answer
If you tell us how far you've got and what piece of code you're having trouble with, we'll help.
i am new in c++
plz give me some hint

We would like you to try the code, post what you have so far even if it is just the part that takes the input from the user. From here we will gladley help you. Don't be afraid of trolls, I'm about as bad as we get here ;).

Also Multi Posting will actually prevent certain more helpful users from commenting so you should avoid that.
1
2
3
4
5
6
7
8
9
10
#include <iostream>
using namespace std;
int main(){
	int i;
	cin >> i;
	if(i>=0&&i<10)cout << 
	"zero\0 one\0  two\0  three\0four\0 five \0six\0  seven\0eight\0nine\0"
	+i*6 << endl;
	else cout << "not a digit\n";
}

Now make sure you figure out how it works.
Last edited on
Now that's a cool answer. The OP's teacher won't take it unless they can stand there and explain it though.
Exactly my point. He should learn why that code works, and of course why he shouldn't do something like that in a real job.
Topic archived. No new replies allowed.