I wrote this code in C ++ in Codeblocks with class Register_moradores, but this is giving the error
error: ld returned 1 exit status
I did not find anything to help me on the internet. I do not know how to program very well yet.
In one example, my teacher used this mode to "call the class" (I do not know how to say, declare maybe?):
int main()
{
Automovel p;
p.CadastrarAutomovel();
p.ImprimirAutomovel();
system("pause");
}
and I did not understand why the class name and then the "p" and then call the functions with "p." at the beginning. I've seen other examples but the letters were different.
My code:
#include <iostream>
#include <stdlib.h>
#include <conio.h>
using namespace std;
class Registrar_moradores
{
private:
char nome[200][50];
int telefone[200], npessoas[200],op,linha;
public:
void cadastro() {
do{
cout<<"***CADASTRAMENTOS DOS MORADORES***"<<endl;
cout <<"\nNome:";
cin >>nome[linha];
cout <<"\nNumero do seu telefone principal:";
cin >>telefone[linha];
cout<<"\nNumero de pessoas que moram em sua casa incluindo voce:";
cin >>npessoas[linha];
cout<<"\nCadastrar outra pessoa?\n1=Cadastrar\n2-Sair\nResposta:";
cin>>op;
linha++;
}while (op==1);
}
};
int main(){
Registrar_moradores p;
p.cadastro();
}