Wieso geht cin nicht mit mehrdim. Arrays?? Plz Help!



  • Hallo,

    muss gerade Hausaufgaben machen 😉
    Komischerweise funzt folgender Programmauschnitt nicht.... 😕

    FEHLER: error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::alloc
    ator<char> >' (or there is no acceptable conversion)

    Ich kann per cin keine Werte in das Array einlesen....
    Es scheint als ob er "cin" nicht mehr kennen würde.
    Was muss ich machen?

    Hier der Code:

    #include <iostream>
    #include <math.h>

    using namespace std;

    //[1] Name, [2] before, [3] after, [4] weight loss
    string database [100][4];

    void enterClients(int number){
    for (int k=0; k<number; k++){
    cout<<k<<". client\n";
    cout<<"Please enter her/his name: "; cin>>database[k][0];
    cout<<"Weight one year ago: "; cin>>database[k][1];
    cout<<"Weight now: "; cin>>database[k][2];
    }
    }

    void main() {

    int number = 0;
    cout<<"The maximum client amount is 100."<<endl;
    cout<<"How many clients do you want to enter? ";
    cin>>number;
    cout<<endl<<endl;

    enterClients(number);

    }

    DANKE!!!!!

    Simon



  • #include <string>



  • hi,

    btw

    nicht #include <math.h>
    sondern
    #include <cmath>



  • ...und wenn wir schon dabei sind:
    [cpp]
    int main() {
    [/cpp]


Anmelden zum Antworten