Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Computers for Beginners (https://www.askmehelpdesk.com/forumdisplay.php?f=79)
-   -   Please anyone tell me what is the error of that code? It' s a problem of uva_11233 (https://www.askmehelpdesk.com/showthread.php?t=633024)

  • Feb 3, 2012, 04:30 PM
    Matrix007
    Please anyone tell me what is the error of that code? It' s a problem of uva_11233
    #include <iostream>
    #include <string>
    #include <string.h>
    Using namespace std;

    Int main()
    {
    int L,N;
    char c[100];
    string sin[100], plu[100];
    cin>> L;
    cin>>N;

    for(int I=0;i<L;i )
    {
    cin>> sin[i];
    cin>> plu[i];

    }
    for(int k=0;k<N;k )
    {
    int t=0;
    cin>>c;
    for(int n=0;n<L;n )
    {

    if(c==sin[n])
    {
    cout<<plu[n]<<endl;
    t=1;
    break;
    }

    }
    if(t==0)

    {
    int len = strlen(c);

    if(c[strlen(c)-1]=='y' && (c[strlen(c)-2]!='a' && c[strlen(c)-2]!='e' && c[strlen(c)-2]!='i' && c[strlen(c)-2]!='o' && c[strlen(c)-2]!='u'))
    {
    c[len-1]='i';
    cout<<c;
    cout<<"es"<<endl;


    }
    else if(c[len-1]=='0'|| c[len-1]=='s' || c[len-1]== 'x' || (c[len-2]=='s' && c[len-1]=='h') || (c[len-2]=='c' && c[len-1]=='h'))
    {
    cout<<c;
    cout<<"es"<<endl;
    }
    else
    {
    cout<<c;
    cout<<"s"<<endl;
    }

    }

    }
    return 0;
    }

  • All times are GMT -7. The time now is 11:06 PM.