Thread: error : no match for 'operator<<' in 'std::cin 1935374429'

  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    54

    error : no match for 'operator<<' in 'std::cin 1935374429'

    Hi everybody ! I get this error
    no match for 'operator<<' in 'std::cin 1935374429'
    while compiling this code :
    Code:
    #include <iostream>
    #include <iomanip>
    #include <cstdlib>
    
    
    using namespace std;
    
    
    
    
    void initArray(float largeArray[6][6]){
        for (int x=0; x < 6; x++){
                for (int y=0; y<6; y++){
                      largeArray[x][y] = 0;
            }
        }
    
    
    
    
    }
    
    
    
    
    float printOutArray(float largeArray[6][6]){
        for (int x = 0; x < 6; x++){
    
    
    
    
                for (int y = 0; y < 6; y++){
                        cout << largeArray [x] [y]<<'\t';
                    }
               cout << endl;
            }
    return largeArray[6][6];
    }
    
    
    void tata (int degree_denominator, float largeArray[6][6] ){
    float array_of_coefficients[6];
    int c=0;
    int l=0;
    int x=0;
    for (x=degree_denominator ; x>=0 ; x--){
                                            if (l==1){l=0;c++;}
                                   cout << "what is the coefficient linked with degree" <<x<< "?" << endl;
                                   cin << array_of_coefficients[x];
                                   largeArray[l][c] = array_of_coefficients[x];
                                   l++;
                                       }
    }
    
    
    int main()
    {
        float largeArray [6][6];
        initArray(largeArray);
        printOutArray(largeArray);
        int degree_denominator;
        cout << "what is the degree of the denominator?" << endl;
        cin >> degree_denominator;
        tata(degree_denominator, largeArray);
    
    
    }
    My error is in my function "tata" at the line where the cin is.
    I have no clue where this error comes from, if someone could tell me something to delete this error i would greatly appreciate it

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > cout << "what is the coefficient linked with degree" <<x<< "?" << endl;
    > cin << array_of_coefficients[x];
    Which way round should >> and << be?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Feb 2013
    Posts
    54
    What a stupid beginner error!! OK thank you i have to write : cin >> array_of_coefficients[x];

  4. #4
    Internet Superhero
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    964
    Quote Originally Posted by funnydarkvador View Post
    What a stupid beginner error!! OK thank you i have to write : cin >> array_of_coefficients[x];
    Think of it like this:

    With "cin >> myvariable" the data moves from stdin to the variable. With "cout << myvariable" the data moves from the variable to stdout. So the flow always follows the directions of the arrows/stream operators. That's an easy way to remember it.
    How I need a drink, alcoholic in nature, after the heavy lectures involving quantum mechanics.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fix basic error: no match for 'operator!=' in 'i != ...
    By aeolusaether in forum C++ Programming
    Replies: 7
    Last Post: 04-04-2010, 12:27 AM
  2. Replies: 9
    Last Post: 03-30-2009, 06:37 PM
  3. no match for 'operator>>'
    By Taka in forum C++ Programming
    Replies: 3
    Last Post: 03-30-2009, 12:17 AM
  4. new to C++ : Error: no match for `operator` ....
    By MasterACE14 in forum C++ Programming
    Replies: 13
    Last Post: 05-23-2008, 01:56 AM
  5. Replies: 3
    Last Post: 06-05-2006, 10:18 AM