Robię program, który gromadzi oceny studentów. Niestety kompilator wywala błędy. mogałbym prosić o naprowadzenie w czym tkwi problem?
Kod:
- Program.c
#include<stdio.h>
#include<stdlib.h>
#include"student.h"
int main()
{
student grupa[30];
int i,j,k,studentow;
char im[30],naz[30],oc[4];
studentow=0;
while(1){
/*Tu mam wczytać i spr czy da się wczytywać plik*/
scanf("%s %s %s",im,naz,oc);
normalize(im);normalize(naz);
for(i=0;i<studentow-1;i++)
if(strcmp(im,grupa[i].imie)&&strcmp(naz,grupa[i].naz))
{found++;strcpy( );grupa[i].liczba_ocen++;break;}
}
qsort(grupa,liczba_studentow,studentCmp);
for(i=0;i<=liczba_studentow;i++){
printf("%s %s : ",grupa[i].nazwisko,grupa[i].imie);
for(j=0;j<=grupa[i].liczba_ocen;j++) printf("%s ",grupa[i].ocena[j]);
s=0;
for(j=0;j<=grupa[i].liczba_ocen;j++){
switch grupa[i].ocena[j]{
case '+2''2+' : s+=2.25;
case '2' '2.0' '2.' s+=2;
case '3' '3.0' '3.' s+= 3;
case '+3' '3+' s+=3.25;
case '3.5' s+=3.5;
case '4' '4.0' '4.' s+=4;
case '4+' '+4' s+=4.25;
case '4.5' s+=4.5;
case '5' '5.0' '5.' s+=5;
default ;}
printf(": %.2f \n",s/grupa[i].liczba_ocen;}
return 0;}
2.studenci.c
/*Porównywanie studenta
*/
#include<stdio.>
#include<string.h>
#include<ctype.h>
{
int studentCmp(student s1,student s2)
int aus;
aus=strcmp(s1.nazwisko,s2.nazwisko);
if(!aus){return aus;}
else {return strcmp(s1.imie,s2.imie);}
}
int normalize(char *str){
int i;
str[0]=toupper(str[0]);
for(i=1;i<31;i++){
if(str[i]=='\0')break;
str[i]=tolower(str[i]);
}
}
3.studenci.h:
typedef struct {
char nazwisko[30];
char imie[30];
char oceny[30][4];
int liczba_ocen;}student;
void normalize(char *str);