Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
#define COURSENAMELENGTH 50 // DERS ADI UZUNLUGU
#define COURSECODELENGTH 10 // DERS KODU UZUNLUGU
#define COURSESMAX 5 // Maximüm des yükü
#define DIPLOMAMAX 5 // Maximüm Diploma saysı

typedef struct fullName{ //tam adı
char *name; //adı
char *surname; //soyadı
}name_t;

typedef struct dates{ //tarih
int day; //gün
 char* month; //ay
 short year; //yıl
}date_t;

typedef struct diploma{ //diploma
char *facName; //fakülte adı
 char *deptName; //bölüm adı
char *level; //lisans, Yüksek Lisans veya Doktora
date_t dateAwarded; //diploma tarihi
}diploma_t;

typedef struct courseOffered{ //kayıtlı Dersler
char courseName[COURSENAMELENGTH]; //ders adı
char courseCode[COURSECODELENGTH]; //ders kodu
 date_t startDate; //dersin başlangıç tarihi
 date_t endDate; //dersin bitiş tarihi
}course_t;

typedef struct employeeInfo{ /öğretmen bilgisi
name_t employeeName; //öğretmen adı
diploma_t dip[DIPLOMAMAX]; //diploma bilgisi
course_t noCourses[COURSESMAX] //verdiği derslerin listesi
int age; //yaş
double salary; //maaş
 date_t startDate; //işe Başlangıç Tarihi
 date_t dateOfBirth; //dogüm Tarihi
}employee_t;


What I have tried:

i have tried the code it is saying error
Posted
Updated 18-Feb-21 11:30am
Comments
Greg Utas 18-Feb-21 15:26pm    
You need to specify where errors occur. And you don't have any executable code, just a bunch of types.

You missed a slash in the comment:
C++
typedef struct employeeInfo{ /öğretmen bilgisi
Should be
C++
typedef struct employeeInfo{ //öğretmen bilgisi

If you look at the error message, it tells you the line - 31 - and column - 30 - at which it found the problem. Together with the message itself, that should give you enough clues to fix problems like this yourself.
 
Share this answer
 
Did you forget your main function?

I just created, compiled and ran the following:

C++
#include <stdio.h>

#define TEST  int main(int argc, char* args []){ printf("Hello, World!\n");  }

TEST
 
Share this answer
 
Your problem has already been noted (S2) but I have a tip for you. In your code you have this :
C++
#define COURSENAMELENGTH  50 // DERS ADI UZUNLUGU
#define COURSECODELENGTH  10 // DERS KODU UZUNLUGU

typedef struct courseOffered                 //kayıtlı Dersler
{
    char       courseName[COURSENAMELENGTH]; //ders adı
    char       courseCode[COURSECODELENGTH]; //ders kodu
    date_t     startDate;                    //dersin başlangıç tarihi
    date_t     endDate;                      //dersin bitiş tarihi
} course_t;
and that's fine. The thing is you are going to see some awkwardness in code. This is because you always have to remember that c-strings have a terminating null character. When you copy a string you should always be careful of the length so you should do something like this :
C++
strncpy( course.courseName, name, COURSENAMELENGTH - 1 );
so there is space left for the null.

I prefer to deal with that by defining types for the strings that account for the null explicitly. They would look like this :
C++
typedef char cname_str[ COURSENAMELENGTH + 1 ];
typedef char ccode_str[ COURSECODELENGTH + 1 ];
and the structure becomes :
C++
typedef struct courseOffered                 //kayıtlı Dersler
{
    cname_str  courseName;                   //ders adı
    ccode_str  courseCode;                   //ders kodu
    date_t     startDate;                    //dersin başlangıç tarihi
    date_t     endDate;                      //dersin bitiş tarihi
} course_t;
but the good thing about this is it simplifies the code. Copying the string would look like this :
C++
strncpy( course.courseName, name, COURSENAMELENGTH );
and everywhere you access the string like that you don't have to subtract one because the type takes that into account for you. Correspondingly, the length definitions should NOT account for the null character because the type does it. If the diploma length is really four characters long then define it to be four, not five.

I realize this is a minor point but once you get in the habit of doing this you never have to subtract one for the length again. That is, unless you use the sizeof operator and there's no way around it there.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900