> 生活助理 > 从键盘输入一个字符串(从键盘输入一个小于1000的正数)

从键盘输入一个字符串(从键盘输入一个小于1000的正数)

从键盘输入一个字符串(从键盘输入一个小于1000的正数)

关于从键盘输入一个字符串,从键盘输入一个小于1000的正数这个很多人还不知道,今天小六来为大家解答以上的问题,现在让我们一起来看看吧!

1、123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869#include #include using namespace std; int n; int main(){    scanf(\"%d\", &n);    int v = n/100;         if (v == 9) printf(\"Nine hundred\");    else if (v == 8) printf(\"Eight hundred\");    else if (v == 7) printf(\"Seven hundred\");    else if (v == 6) printf(\"Six hundred\");    else if (v == 5) printf(\"Five hundred\");    else if (v == 4) printf(\"Four hundred\");    else if (v == 3) printf(\"Three hundred\");    else if (v == 2) printf(\"Two hundred\");    else if (v == 1) printf(\"One hundred\");         if (!(n%100))    {        printf(\".\");        return 0;    }         printf(\" and \");         v = (n/10)%10;         if (v == 9) printf(\"ninety \");    else if (v == 8) printf(\"eighty \");    else if (v == 7) printf(\"seventy \");    else if (v == 6) printf(\"sixty \");    else if (v == 5) printf(\"fifty \");    else if (v == 4) printf(\"forty \");    else if (v == 3) printf(\"thirty \");    else if (v == 2) printf(\"twenty \");    if (v == 1)    {        v = n%10;             if (v == 9) printf(\"nineteen\");        else if (v == 8) printf(\"eighteen\");        else if (v == 7) printf(\"seventeen\");        else if (v == 6) printf(\"sixteen\");        else if (v == 5) printf(\"fifteen\");        else if (v == 4) printf(\"fourteen\");        else if (v == 3) printf(\"thirteen\");        else if (v == 2) printf(\"twelve\");        else if (v == 1) printf(\"eleven\");        else if (v == 0) printf(\"ten\");    }         if ((n/10)%10 != 1)    {        v = n%10;             if (v == 9) printf(\"nine\");        else if (v == 8) printf(\"eight\");        else if (v == 7) printf(\"seven\");        else if (v == 6) printf(\"six\");        else if (v == 5) printf(\"five\");        else if (v == 4) printf(\"four\");        else if (v == 3) printf(\"three\");        else if (v == 2) printf(\"two\");        else if (v == 1) printf(\"one\");    }         printf(\".\");    return 0;}幸苦打的。

2、望采纳。

本文到此分享完毕,希望对大家有所帮助。