Sort by

recency

|

1660 Discussions

|

  • + 0 comments
    void numberspell (int n ,int m) {
    
    string spell[]= {"one","two", "three", "four","five","six","seven","eight","nine"} ;
    
    for (;n<=m ;n++) {
        if (n>= 0 && n <=9)
          cout << spell[n-1] << endl; 
       if (n>9) {
          if (n%2) cout << "odd"<< endl;
          else cout << "even"<< endl ;
       }
    }
    

    }

  • + 0 comments
    #include <iostream>
    #include <cstdio>
    using namespace std;
        
    #define Low_Threshold   1
    #define High_Threshold  9
        
    string namingdb[11] = {"one","two","three","four","five","six","seven","eight","nine","even","odd"};
        
    int main() {
        int a,b;
    
        cin>>a>>b;
        for (int i=a; i<=b;i++)
        {
            if (i>=Low_Threshold && i<=High_Threshold)  
                                       cout<<namingdb[i-Low_Threshold]<<endl;
            else if (i>High_Threshold)
                                       cout<<namingdb[(High_Threshold+(i%2))]<<endl;
            else                        /*Do Nothing*/;
        }
        return 0;
    }
    
  • + 1 comment
    using namespace std;
    int main() {
        unsigned int a;
        unsigned int b;
        string s_arr[] = {"one","two","three","four","five","six","seven","eight","nine"};
        
        cin >> a;
        cin >> b;
        
        for(; a <= b; ++a){
            if(a <= sizeof(s_arr)/sizeof(s_arr[0])) cout << s_arr[a-1] << endl;
            if(a > sizeof(s_arr)/sizeof(s_arr[0])){
                if((a%2) == 0) cout << "even\n";
                else cout << "odd\n";
            }
        }
        
        return 0;
    }
    
  • + 0 comments

    int n, m; cin >> n >> m;

    for (int i = n; i <= m; i++) {
        if (i == 1) {
            cout << "one" << endl;
        }
        else if (i == 2) {
            cout << "two" << endl;
        }
        else if (i == 3) {
            cout << "three" << endl;
        }
        else if (i == 4) {
            cout << "four" << endl;
        }
        else if (i == 5) {
            cout << "five" << endl;
        }
        else if (i == 6) {
            cout << "six" << endl;
        }
        else if (i == 7) {
            cout << "seven" << endl;
        }
        else if (i == 8) {
            cout << "eight" << endl;
        }
        else if (i == 9) {
            cout << "nine" << endl;
        }
        else {
            if (i % 2 == 0) {
                cout << "even" << endl;
            }
            else {
                cout << "odd" << endl;
            }
        }
    }
    
  • + 0 comments
    int main() {
        
        int i;
        int j;
        cin >> i;
        cin >> j;
        string numbers[10] = {"zero","one","two","three","four","five","six","seven","eight","nine"};
        
        for(int a = i; a <= j; a++){
            if (a >= 0 && a <= 9) {
                cout << numbers[a] << "\n";
            }else if(a % 2 == 0){
                cout << "even\n";
            }else{
                cout << "odd\n";
            }
        }
        return 0;
    }