I am pretty new to c++ so please pardon my incompetence. This is the code, it's about trying to find the sum of 2 matrices:
#include <iostream>
#include "functions.h"
using namespace std;
void saisir_matrice(int l, int c, int matriceA[][colonnes], int matriceB[][colonnes])
{
cout << "Entrez vos numéros" << endl;
for (int i = 0; i < l; i++)
{
for (int j = 0; j < c; j++)
{
cin >> matriceA[i][j];
}
}
}
I'm not sure what the problems are, but I have several errors on the first line, such as:
expected qualified id before int
symbol colonnes could not be resolved
expected ')' before ',' token
I know what these errors mean, it means there's something wrong with the way I wrote the function, but I can't seem to find them in my first line.
edit here is what functions.h looks like so far:
#ifndef FUNCTIONS_H_
#define FUNCTIONS_H_
void saisir_matrice(int lignes, int colonnes, int matriceA[][colonnes], int matriceB[][colonnes]);
#endif /* FUNCTIONS_H_ */
and here is what my main function looks like:
#include <iostream>
#include "functions.h"
using namespace std;
int main()
{
int COLONNES;
int LIGNES;
cout << "entrez 2 nombres" << endl;
cin >> COLONNES;
cin >> LIGNES;
int matriceA[LIGNES][COLONNES];
int matriceB[LIGNES][COLONNES];
saisir_matrice(LIGNES, COLONNES, matriceA, matriceB);
return 0;
}
The point was to try and pass the arrays as variables, but there are a ton of syntax errors I can't find. Here are the error messages:
- Symbol 'colonnes' could not be
resolved
- Symbol 'colonnes' could not be
resolved
- expected ‘)’ before ‘,’ token
- expected unqualified-id before ‘int’