PRG122804 2018 2 AULA13: mudanças entre as edições
Ir para navegação
Ir para pesquisar
(8 revisões intermediárias pelo mesmo usuário não estão sendo mostradas) | |||
Linha 1: | Linha 1: | ||
=Correção= | =Correção da AT2= | ||
''Em sala de aula!!!'' | |||
== | ==Estatísticas== | ||
O(s) gráfico(s) abaixo mostram um histograma de notas das unidades da turma. O histograma mostra as notas de 0 a 10 e quantos alunos tiraram essas notas. Abaixo dos gráficos, é possível ver a média e desvio padrão de cada unidade (Avaliação). | |||
===2018-2=== | |||
[[imagem:fig006_PR1022804.jpg|600px|center]] | |||
[*Unidade 2 = Avaliação Teórica 2 (AT2)] | |||
===2018-1=== | |||
<center> | |||
'''AT2 - Avaliação Teórica 2''' | |||
[[imagem:fig001_PR1022804.jpg|600px]] | |||
:Média: 6,52 | |||
:Desvio Padrão: 2,41 | |||
</center> | |||
==Questões: 2018-2== | |||
===1=== | |||
<syntaxhighlight lang=c> | |||
#include <stdio.h> | |||
void funcA() | |||
{ | |||
printf("Esta é a função funcA()\n"); | |||
} | |||
void funcB() | |||
{ | |||
printf("Esta é a função funcB()\n"); | |||
funcD(); | |||
} | |||
void funcC() | |||
{ | |||
funcA(); | |||
printf("Esta é a função funcC()\n"); | |||
funcB(); | |||
} | |||
void funcD() | |||
{ | |||
printf("Esta é a função funcD()\n"); | |||
} | |||
void main() | |||
{ | |||
funcC(); | |||
} | |||
</syntaxhighlight> | |||
===2=== | |||
<syntaxhighlight lang=c> | |||
#include <stdio.h> | |||
int i=1; | |||
void func() | |||
{ | |||
int i=10; | |||
i++; | |||
printf( "Valor de i = %d na função func()\n", i ); | |||
} | |||
void main() | |||
{ | |||
i--; | |||
func(); | |||
printf( "Valor de i = %d \n", i ); | |||
} | |||
</syntaxhighlight> | |||
===3=== | |||
<syntaxhighlight lang=c> | |||
#include <stdio.h> | |||
#include <math.h> | |||
void main() | |||
{ | |||
float y,a,b; | |||
a=16; | |||
b=9; | |||
y = sqrt(sqrt(pow(a,2))*b); | |||
printf ("%0.1f", y); | |||
} | |||
</syntaxhighlight> | |||
===4=== | |||
<syntaxhighlight lang=c> | |||
#include <stdio.h> | |||
void main() | |||
{ | |||
int y,x[10] = {2,4,7,-5,3,2,3,4,9,10}; | |||
y=x[3]+x[9]/2; | |||
printf("Valor de y: %d\n",y); | |||
} | |||
</syntaxhighlight> | |||
===5=== | |||
<syntaxhighlight lang=c> | |||
#include <stdio.h> | |||
void montar_vet(int aux[5]) | |||
{ | |||
int i; | |||
for (i=0;i<5;i++) { | |||
aux[i]=aux[i]*(-1); | |||
} | |||
} | |||
void main() | |||
{ | |||
int y,vet[5]={-1,2,4,8,-16}; | |||
montar_vet(vet); | |||
y=vet[1]+vet[4]; | |||
printf("Valor de y: %d\n",y); | |||
} | |||
</syntaxhighlight> | |||
===6=== | |||
<syntaxhighlight lang=c> | |||
#include <stdio.h> | |||
void main () | |||
{ | |||
char alfa[100]="Sao Sebastiao da Vargem Alegre"; | |||
int y=0; | |||
while(alfa[y]!=0) | |||
y++; | |||
printf ("Valor de y: %d\n", y); | |||
} | |||
</syntaxhighlight> | |||
===7=== | |||
<syntaxhighlight lang=c> | <syntaxhighlight lang=c> | ||
Linha 28: | Linha 184: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===8=== | |||
<syntaxhighlight lang=c> | |||
#include <stdio.h> | |||
void main() | |||
{ | |||
char TabCidades[5][20] ={"Itajai","Navegantes","Joinville", | |||
"Tijucas","Florianopolis"}; | |||
printf("Resultado: %c%c%c%c\n",TabCidades[0][0],TabCidades[4][0], | |||
TabCidades[1][9],TabCidades[3][4]); | |||
} | |||
</syntaxhighlight> | |||
===9=== | |||
<syntaxhighlight lang=c> | |||
#include <stdio.h> | |||
struct TEndereco{ | |||
char rua[50]; | |||
char numero[10]; | |||
char CEP[9] | |||
}; | |||
struct TPessoa{ | |||
char nome[50]; | |||
char data_nasc[11]; | |||
struct TEndereco endereco; | |||
int num_filhos; | |||
} Cliente={"Douglas A.","07/01/1972",{"Rua das Flroes","999","88000123"},2}; | |||
void main(){ | |||
printf("\nRua: %s\nData nasc.: %s",Cliente.endereco.rua,Cliente.data_nasc); | |||
} | |||
</syntaxhighlight> | |||
===10=== | |||
<syntaxhighlight lang=c> | |||
#include <stdio.h> | |||
void main() | |||
{ | |||
int x,y,w,*p1,*p2,**p3; | |||
x = 10; | |||
w = 5; | |||
y = 1; | |||
p1 = &x; | |||
p2 = &w; | |||
y = *p1 + w; | |||
p2 = &y; | |||
x = *p2 + w; | |||
p3 = &p2; | |||
y = *p1 + *p2 + **p3; | |||
printf("Valor de y: %d",y); | |||
} | |||
</syntaxhighlight> | |||
Edição atual tal como às 20h15min de 31 de outubro de 2018
1 Correção da AT2
Em sala de aula!!!
1.1 Estatísticas
O(s) gráfico(s) abaixo mostram um histograma de notas das unidades da turma. O histograma mostra as notas de 0 a 10 e quantos alunos tiraram essas notas. Abaixo dos gráficos, é possível ver a média e desvio padrão de cada unidade (Avaliação).
1.1.1 2018-2

[*Unidade 2 = Avaliação Teórica 2 (AT2)]
1.1.2 2018-1
AT2 - Avaliação Teórica 2
- Média: 6,52
- Desvio Padrão: 2,41
1.2 Questões: 2018-2
1.2.1 1
#include <stdio.h>
void funcA()
{
printf("Esta é a função funcA()\n");
}
void funcB()
{
printf("Esta é a função funcB()\n");
funcD();
}
void funcC()
{
funcA();
printf("Esta é a função funcC()\n");
funcB();
}
void funcD()
{
printf("Esta é a função funcD()\n");
}
void main()
{
funcC();
}
1.2.2 2
#include <stdio.h>
int i=1;
void func()
{
int i=10;
i++;
printf( "Valor de i = %d na função func()\n", i );
}
void main()
{
i--;
func();
printf( "Valor de i = %d \n", i );
}
1.2.3 3
#include <stdio.h>
#include <math.h>
void main()
{
float y,a,b;
a=16;
b=9;
y = sqrt(sqrt(pow(a,2))*b);
printf ("%0.1f", y);
}
1.2.4 4
#include <stdio.h>
void main()
{
int y,x[10] = {2,4,7,-5,3,2,3,4,9,10};
y=x[3]+x[9]/2;
printf("Valor de y: %d\n",y);
}
1.2.5 5
#include <stdio.h>
void montar_vet(int aux[5])
{
int i;
for (i=0;i<5;i++) {
aux[i]=aux[i]*(-1);
}
}
void main()
{
int y,vet[5]={-1,2,4,8,-16};
montar_vet(vet);
y=vet[1]+vet[4];
printf("Valor de y: %d\n",y);
}
1.2.6 6
#include <stdio.h>
void main ()
{
char alfa[100]="Sao Sebastiao da Vargem Alegre";
int y=0;
while(alfa[y]!=0)
y++;
printf ("Valor de y: %d\n", y);
}
1.2.7 7
#include <stdio.h>
void ordenar(int aux[],int tam){
int i,j,temp;
for(j=0;j<4;j++)
for(i=0;i<4;i++)
if (aux[i]>aux[i+1]){
temp=aux[i];
aux[i]=aux[i+1];
aux[i+1]=temp;
}
}
void main()
{
int i,vet[5]={5,3,1,9,2};
ordenar(vet,5);
for(i=0;i<5;i++)
printf("\n%d",vet[i]);
}
1.2.8 8
#include <stdio.h>
void main()
{
char TabCidades[5][20] ={"Itajai","Navegantes","Joinville",
"Tijucas","Florianopolis"};
printf("Resultado: %c%c%c%c\n",TabCidades[0][0],TabCidades[4][0],
TabCidades[1][9],TabCidades[3][4]);
}
1.2.9 9
#include <stdio.h>
struct TEndereco{
char rua[50];
char numero[10];
char CEP[9]
};
struct TPessoa{
char nome[50];
char data_nasc[11];
struct TEndereco endereco;
int num_filhos;
} Cliente={"Douglas A.","07/01/1972",{"Rua das Flroes","999","88000123"},2};
void main(){
printf("\nRua: %s\nData nasc.: %s",Cliente.endereco.rua,Cliente.data_nasc);
}
1.2.10 10
#include <stdio.h>
void main()
{
int x,y,w,*p1,*p2,**p3;
x = 10;
w = 5;
y = 1;
p1 = &x;
p2 = &w;
y = *p1 + w;
p2 = &y;
x = *p2 + w;
p3 = &p2;
y = *p1 + *p2 + **p3;
printf("Valor de y: %d",y);
}