3
I’m making a code that needs to contain 3 vectors (number one. enrollment, grade 1 and grade 2), relative to 6 students, which needs to be included:
- the final grade of each student;
- class average;
- o Núm. of students with grades below the class average.
I made the code as far as I know, but it did not compile, (some error in variable declaration vetor
). And print table style as done?
#include <stdio.h>
int main ()
{
float nota1 [6], nota2 [6], nf, medturma;
int nm [6];
int i;
for (i=0;i<=6; i++);
{
printf("Informe o número de matrícula %d :", i);
scanf("%d", &nm[i]);
printf("Informe a nota 1 do aluno %d:", i);
scanf("%f", ¬a1[i]);
printf("Informe a nota 2 do aluno %d:", i);
scanf("%f", ¬a2[i]);
}
for (i=0; i<=6; i++)
{
nf= (nota1[i] + nota2[i])/2;
}
printf("A nota final de cada aluno é :",i);
medturma=nf[i]/6;
printf("A media da turma foi %f:", i);
if (nf<medturma)
printf("Notas abaixo da média %f:", i);
}
the error is occurring because on line 28 you are passing the variable
nf
as if it were a vector, in case you should declare it above asnf[6]
so that it could work, that was just the compilation analysis, fixing this it will compile– Gabriel Rodrigues
The error still persists.
– RafNP
It is duplicated: http://answall.com/questions/86842/como-usar-vectors
– Maniero
Can you help me? That hour I sent via cel. the image (I had no way to send)
– RafNP
@moustache the url looks the same..
– Gabriel Rodrigues
Explain what the program should do. It does not even compile, it has a huge amount of errors. Mainly the second part is very confusing.
– Maniero
program to read and store (in three vectors) the Matricula Number (integer), Nota1 (real) and Nota2 (real) of each student in a class of 6 students. Calculate the final grade of each student, the class average, the number of students with a final grade lower than the average. Print at the end all data involved table style
– RafNP
@user32720 I realized you only gave one vote until today. Did you know you can vote for everything on the site? Anything that helped you with your questions, or even any other questions. And you can accept an answer as the most correct in every question you’ve ever asked. You are not obliged to do this, but it is interesting for everyone who does. It ranks and indicates better what was useful to you. Of course, you shouldn’t vote for things you don’t consider useful or that didn’t help. See [tour] to better understand.
– Maniero