c++ help

  • can anyone help me with this.
    Basicaly what the script does, is to ask a verb to a user and then list all the persons of the verb in the present(in french).
    All i want is to a make a loop that take a pronom[i] add it to the unchanging part of the verb and add the time part.
    Like this take pronom[1] add ... add lastpart[1]
    anyoneknows how can i do it? my script above doesn't work...


    #include
    #include
    using namespace std;
    void main(void)
    {
    string pronom1= "je ",
    pronom2 = "tu ",
    pronom3 = "il / elle / on ",
    pronom4 = "nous ",
    pronom5 = "vous ",
    pronom6 = "Ils /Elles ",
    terminaison1 = "e",
    terminaison2 = "es",
    terminaison3 = "e",
    terminaison4 = "ons",
    terminaison5 = "ez",
    terminaison6 = "ent",
    verbe_inf,
    radical_verbe,
    verbe_conj;
    cout << "Entrez un verbe a l'infinitf " < cin >> verbe_inf;
    radical_verbe = verbe_inf.erase((verbe_inf.size()-2),2);
    for (int i =1; i<7; i++){
    verbe_conj = pronom[i]+ radical_verbe + terminaison[i];
    cout < }


  • I'm not familiar with c++, but in your for loop it looks like pronom[i] is in an array notation (square brackets)? This will not work the way you want to call the string variables that hold the values. You will need to create an array and put the individual pronoms inside the array and access them via their index. This is how it would be done in c# (not the entire code but the array and for loop part) Hopefully you can follow it and implement it in c++.


    // This creates a string array called pronoms and inside the curly braces are the elements
    string pronoms = new string[6] { "je ", "tu ", "il / elle / on ", "nous ", "vous", "Ils /Elles " }

    for (int i = 0; i < 7; i++)
    {
    // Add the individual array elements to the verbe_inf (if its a string)
    verbe_inf = pronoms[i] + otherStrings + otherVariables;
    }Hopefully you can kinda see whats happening. Hope it helps.


  • Don't forget to free up your memory:
    delete pronoms;







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about c++ help , Please add it free.

    17 March 2010 | cameltoepants.com | edit