I can not fix the error, and not back to the main menu and or alter someone help me fix the code please?

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
  I can not correct the error, and not back to the main menu, or change someone help me fix the code, please, I'm doing a barbershop system and I can not change, delete, add, search in Notepad someone help me please?
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
struct documento {
typedef struct {
char nada[10];
char nome[40];
char cpf[14];
char rg[12];
char telefone[20];
char ende[30];
char sexo[15];
char nacionalidade[15];
char hora_entrada[10];
char hora_saida[10];
void voltar (){
int opc;
printf("Deseja voltar ao menu 1-SIM \n");
scanf("%d", &opc);
switch (opc){

}
}

//====================================================== FIM ==================================================

//====================================================== FUNÇÃO QUEBRA LINHA ==================================
void quebra_linha(){
printf("\n\n");
}
}trabalho;
FILE *trab;
int menu(){
int num;

printf("\t\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB\xDB SISTEMA BARBEARIA v.1.0 \xDB Beta \xDB\t\n");
printf("\t\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB --> ESCOLHA UMA DAS OPCOES ABAIXO <-- \xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB ------------------------------------------------------- \xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB 1 - Cliente || 0 - Sair \xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB ------------------------------------------------------- \xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\t\n");
printf("C.R.F - Escolha Uma Opcao ->"); 

scanf("%d",&num);
system("cls");
return num;
}
trabalho cliente(){
int num1;
trabalho t;

printf("\t\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB\xDB OPCOES de Cliente v.1.0 \xDB Beta \xDB\t\n");
printf("\t\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB --> ESCOLHA UMA DAS OPCOES ABAIXO <-- \xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB ------------------------------------------------------- \xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB 1 - NOVO | 2 - ALTERAR | 3 - EXCLUIR | 4 - IMPRIMIR \xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB ------------------------------------------------------- \xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB 5 - VOLTAR \xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB ------------------------------------------------------- \xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB ------------------------------------------------------- \xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB DIGITE UMA OPCAO \xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB ------------------------------------------------------- \xDB\xDB\xDB\t\n");
printf("\t\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\t\n");

scanf("%d",&num1);
if(num1==1){
trab=fopen("Cad_Cliente.txt", "a");
fgets(t.nada,10,stdin);
printf("INFORME SEU NOME: \n");
fgets(t.nome,40,stdin);
printf("INFORME SEU CPF: \n");
fgets(t.cpf,14,stdin);
printf("INFORME SEU RG: \n");
fgets(t.rg,12,stdin);
printf("INFORME SEU TELEFONE: \n");
fgets(t.telefone,20,stdin);
printf("INFORME SEU ENDERECO: \n");
fgets(t.ende,30,stdin);
printf("INFORME SEU SEXO: \n");
fgets(t.sexo, 15, stdin);
printf("INFORME SUA NACIONALIDADE: \n");
fgets(t.nacionalidade, 15, stdin);
printf("INFORME SUA HORA DE CHEGADA: \n");
fgets(t.hora_entrada, 10, stdin);
printf("INFORME SUA HORA DE SAIDA: \n");
fgets(t.hora_saida, 10, stdin);
printf("\nCadastro efetuado com sucesso!! \n");
int opc;{
printf("\nDeseja voltar ao menu 1-SIM \n");
scanf("%d", &opc);
switch (opc){

}
}

getchar();
char *textonome="NOME:";
char *texto1=t.nome;
char *texto2="CPF:";
char *texto3=t.cpf;
char *texto4="RG:";
char *texto5=t.rg;
char *texto6="TELEFONE:";
char *texto7=t.telefone;
char *texto8="ENDERECO:";
char *texto9=t.ende;
char *texto10="SEXO:";
char *texto11=t.sexo;
char *texto12="NACIONALIDADE:";
char *texto13=t.nacionalidade;
char *texto14="HORA DA ENTRADA:";
char *texto15=t.hora_entrada;
char *texto16="HORA DA SAIDA:";
char *texto17=t.hora_saida;


fputs(textonome,trab);
fputs(texto1,trab);
fputs(texto2,trab);
fputs(texto3,trab);
fputs(texto4,trab);
fputs(texto5,trab);
fputs(texto6,trab);
fputs(texto7,trab);
fputs(texto8,trab);
fputs(texto9,trab);
fputs(texto10,trab);
fputs(texto11,trab);
fputs(texto12,trab);
fputs(texto13,trab);
fputs(texto14,trab);
fputs(texto15,trab);
fputs(texto16,trab);
fputs(texto17,trab);
fclose(trab);
return t;
}
if(num1==4){
FILE *trab;
int ch;
trab = fopen("Cad_Cliente.txt","r");
if(trab == NULL){
printf("Arquivo inexistente!!!");
system("pause");

}
while((ch = fgetc(trab)) != EOF){
printf("%c",ch);
}


}
}
void ALTERAR(void){
int pos;
pos=busca();
if (pos==-1)
{
printf("\nNumero inexistente no arquivo");
getch();
}
else if(pos==-2)
{
printf("\nNumero inexistente no arquivo!");
getch();
}
else
{
abrir("rb+");
fseek(ft,pos*sizeof(struct documento),SEEK_CUR);
fread(&t, sizeof(struct documento), 1, ft);t
printf("\nDeseja alterar o seguinte registro?");
printf("\n SEU NOME:%s",t.nome,40,stdin);
printf("\n SEU CPF:%s",t.cpf,14,stdin)
printf("\n SEU RG:%s",t.rg,12,stdin);
printf("\n SEU TELEFONE:%s",t.telefone,20,stdin);
printf("\n SEU ENDERECO:%s",t.ende,30,stdin);
printf("\n SEU SEXO:%s",t.sexo, 15, stdin);
printf("\nSUA NACIONALIDADE:%s",t.nacionalidade, 15, stdin);
printf("\n SUA HORA DE CHEGADA:%s",t.hora_entrada, 10, stdin);
printf("\n SUA HORA DE SAIDA:%s",t.hora_saida, 10, stdin);
getch();
printf("\nDigite as informacoes corretas:");
printf("\nNOME:");
gets(t.nome);
printf("\nCPF:");
gets(t.cpf);
printf("\nRG:");
gets(t.rg);
printf("\nTELEFONE:");
gets(t.telefone);
printf("\nENDERECO:");
gets(t.ende);
printf("\nSEXO:");
gets(t.sexo);
printf("\nNACIONALIDADE:");
gets(t.nacionalidade);
printf("\nHORA DE CHEGADA:");
gets(t.hora_entrada);
printf("\nHORA DE SAIDA:");
gets(t.hora_saida);
t.status='1';
fseek(ft,pos*sizeof(struct documento),SEEK_SET);
if(fwrite(&t, sizeof(struct documento),1, ft)!=1)
{
printf("\nErro na gravacao!");
}
else
{
printf("\nAlteracao feita com sucesso!");
getch();
}
}
fclose(ft);
}

int main(){

trabalho x[100];
int cont;
int num, num2;
while(num!=0){
num=menu();
switch(num){
case 1: x[cont]=cliente();
cont++;
break;
case '2':
system("exit");
break;

}
}
} 
Cara, pelo que percebo você fala português.
Você poderia postar os erros?

Você está cometendo erros HORRÍVEIS.

1. Usando system("alguma_coisa");
É apenas para um único SO (use exit(STATUS_DE_RETORNO_INTEIRO) para sair do programa);
2. Como mais importante: você não está definindo onde estão suas funções.
Uma estrutura de dados é onde você armazena dados (óbvio). Se você o usa dessa maneira, precisa declará-lo como estático (static), ou criar um objeto.
3. Isso NÃO É C++.
Você está usando C com as Orientação-à-objetos do C++.
4. Faltaram MUITOS pontos e vírgulas no seu código.

Espero que , quando você arrumar essas coisas, o código funcione.
Até mais!
[]'s
------
English
------
Can you post the errors?

I've saw these:

1. (BAD) Using system("something");
It's SO dependent (use exit(INT_RETURN_STATUS) to exit the program);
2. Your compiler don't know where are the functions.
You need to set them as static, or create an object.
3. That's not C++
You are only using classes, but all the functions are from C.
4. Semicolons (;).

When you make these things right, I hope that your code works.
Good bye!
Your code is poor-like :(
I've fixed (almost everything) it. You can get it here: http://pastebin.com/hiXmAMAu
But in lines 184, 185 and 228, you'll get some errors, because I don't know what you want with t and ft , and function buscar() is empty too, change it. For other issues, see the coments in the code.

Bye!
Topic archived. No new replies allowed.