-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeneme3.cpp
More file actions
60 lines (54 loc) · 1.16 KB
/
Copy pathdeneme3.cpp
File metadata and controls
60 lines (54 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include<stdio.h>
#include<stdlib.h>
typedef struct OGRENCI{
int id;
float vize;
float final;
float ortalama;
struct OGRENCI *next;
}ogrenci;
void ogrenciEkle(ogrenci** ilk)
{
ogrenci* yenidugum=(ogrenci*)malloc(sizeof(ogrenci));
printf("Ogrenci Id:\n"); scanf("%d",¥idugum->id);
printf("Ogrenci vize:\n"); scanf("%f",¥idugum->vize);
printf("Ogrenci final:\n"); scanf("%f",¥idugum->final);
yenidugum->ortalama=(yenidugum->vize*0.4)+(yenidugum->final*0.6);
yenidugum->next=NULL;
if(*ilk==NULL) *ilk=yenidugum;
else
{
ogrenci* temp=*ilk;
while(temp->next!=NULL)
{
temp=temp->next;
}
temp->next=yenidugum;
}
}
void yazdir(ogrenci* ilk)
{
ogrenci* temp=ilk;
printf("Id\tVize\tFinal\tOrtalama\n");
while(temp->next!=NULL)
{
printf("%d\t%.2f\t%.2f\t%.2f\n",temp->id,temp->vize,temp->final,temp->ortalama);
temp=temp->next;
}
printf("\n");
}
int main()
{
ogrenci* ilk=NULL;
int devam=1;
while(devam)
{
char cevap;
ogrenciEkle(&ilk);
printf("Devam etmek ister misiniz?\n"); scanf(" %c",&cevap);
if(cevap=='H' || cevap=='h')
{
devam=0;
}
}
}