void function not ignored as supposed to be

hey, i am trying to create a program to multiply two matricies, i am very close, just this one thing stopping me, i get an error on line 16 & 17 (void display body) which states "void value not ignored as it ought to be". i know it will be something stupid i couldnt see, but here is my code so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <cstdlib>
using namespace std;
int TR, TL, BR, BL, TR2, TL2, BR2, BL2;

void TRR ()
{cout << (TL*TR2) + (TR*BR2);}
void TLR ()
{cout << (TL*TL2) + (TR*BL2);}
void BRR ()
{cout << (BL*TR2) + (BR*BR2);}
void BLR ()
{cout << (BL*TL2) + (BR*BL2);}
void display ()
{
    TLR (); cout << "     "; TRR () << endl;
    BLR (); cout << "     "; BRR () << endl;
}
int main()
{
    cout << "Welcome to Andrew's 2 by 2 matrix multiplication program." << endl;
    cout << "please enter the top left number of the first matrix: ";
    cin >>TL;
    cout << "please enter the top right number of the first matrix: ";
    cin >>TR;
    cout << "please enter the bottom left number of the first matrix: ";
    cin >>BL;
    cout << "please enter the bottom right number of the first matrix: ";
    cin >>BR;
    cout << "please enter the top left number of the second matrix: ";
    cin >>TL2;
    cout << "please enter the top right number of the second matrix: ";
    cin >>TR2;
    cout << "please enter the bottom left number of the second matrix: ";
    cin >>BL2;
    cout << "please enter the bottom right number of the second matrix: ";
    cin >>BR2;
    cout << "the answer is:" << endl;
    display ();
    return 0;
}
TRR () << endl; and BRR () << endl;

You cannot use the << operator on the functions TRR and BRR. I suspect you meant:

TRR (); cout<< endl; and BRR (); cout << endl;
yes! it works, cheers man, thanks alot, i knew it would be something stupid like that
Topic archived. No new replies allowed.