0
The following error is happening in the compilation of the code below:
..\src struct.cpp:19:19: error: Elements of array 'main():ficaha v [3]' have incomplete type .. src struct.cpp:19:19: error: Storage size of 'v' isn’t 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 in structs
and apparently I did exactly as I learned and I’m not seeing any error in the code.
Thanks in advance for your attention!
stay? I think to call the structure must by the same name stated previously.
– Rafael Bluhm