Compile error with structs [closed]

0

The following error is occurring in compiling the code below:

  

.. \ src \ struct.cpp: 19: 19: error: elements of array 'main () :: gets v [3]' have incomplete type   .. \ src \ struct.cpp: 19: 19: error: storage size of 'v' is not known

Code:

#include <string>
#include <iostream>
using namespace std;
#define N 3
struct ficha{
    string nome;
    int idade;
    int reg;
};

int main() {
    struct ficaha v[3];
    int id;
    for (int i=0;i<N;i++){
        cout << "\n\nDgite o NOME do aluno " << i;
        getline(cin,v[i].nome);
        cout << "\n\nDgite a IDADE do aluno " << i;
        cin >> v[i].idade;
        cout << "\n\nDgite o REGISTRO do aluno " << i;
        cin >> v[i].reg;
    }
    cout << "Digite uma idade: ";
    cin >> id;
    cout <<"\nDados dos alunos com idade menor que "<<id<<": "<<endl;
    for (int i=0;i<N;i++){
        if ((v[i].idade) < id){
            cout << v[i].nome << " - " << v[i].idade;
        }
    }
    return 0;
}

This is my first exercise of structs and apparently I did exactly as I learned and I do not see any errors in the code.

Thanks in advance for your attention!

    
asked by anonymous 22.05.2015 / 02:09

1 answer

1

stay

The compilation error is very clear and explanatory:

  

.. \ src \ struct.cpp: 19: 19: error: elements of array 'main () :: gets v [3]' have incomplete type

And you have it in the code:

struct ficha{
...
struct ficaha v[3];

"

, " gets " is a typo.

    
22.05.2015 / 04:59