Skip to content

Commit fd6bd64

Browse files
committed
feat: added prova1
1 parent a21b4d5 commit fd6bd64

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
### VisualStudioCode ###
77
.vscode/*
8+
root/.vscode/*
89
.vscode/settings.json
910
.vscode/tasks.json
1011
.vscode/launch.json

root/provaI.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include <string.h>
4+
5+
typedef struct professor {
6+
char nome[50];
7+
char disciplinas[50];
8+
int regime;
9+
} Professor;
10+
11+
void preencheProfessor(Professor *professor) {
12+
printf("Digite o nome do professor: ");
13+
scanf(" %[^\n]", professor->nome);
14+
printf("Digite as disciplinas do professor: ");
15+
scanf(" %[^\n]", professor->disciplinas);
16+
printf("Digite o regime de trabalho do professor: ");
17+
scanf("%d", &professor->regime);
18+
}
19+
20+
21+
void imprimeProfessor(Professor *professor) {
22+
printf("Nome: %s\n", professor->nome);
23+
printf("Disciplinas: %s\n", professor->disciplinas);
24+
printf("Regime: %d\n", professor->regime);
25+
}
26+
27+
28+
void alteraRegime(Professor *professor, int novoRegime) {
29+
professor->regime = novoRegime;
30+
}
31+
32+
int main(void){
33+
Professor professor;
34+
preencheProfessor(&professor);
35+
imprimeProfessor(&professor);
36+
alteraRegime(&professor, 40);
37+
imprimeProfessor(&professor);
38+
return 0;
39+
40+
}

0 commit comments

Comments
 (0)