Created
March 25, 2018 10:49
-
-
Save GokselKUCUKSAHIN/d7d9f38c5116bb9987f36ab799e46e9c to your computer and use it in GitHub Desktop.
C-Programlama I (Project_31-40)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
char cumle[] = "Merhaba Dunya"; | |
int say=0; | |
int i; | |
for (i=0; cumle[i] != '\0';i++) | |
say++; | |
printf("%s %d karakter icerir.",cumle, say); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int Len(char[]); | |
int main(void) { | |
char cumle[] = "Merhaba Dunya"; | |
char ad[] = "Goksel"; | |
char metin[] = "Erciyes Universitesi"; | |
printf("\n\'\'%s\'\' dizgesi %d adet karakterden olusmaktadir.\n\n",metin,Len(metin)); | |
return 0; | |
} | |
int Len(char A[]){ | |
int i; | |
for(i=0;A[i]!='\0';i++); | |
return(i); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
l | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
struct point{ | |
float x; | |
float y; | |
}; | |
float uzaklik (struct point noktaA ,struct point noktaB) | |
{ | |
// struct point noktaA,noktaB; | |
return(sqrt((noktaA.x-noktaB.x)*(noktaA.x-noktaB.x)+(noktaA.y-noktaB.y)*(noktaA.y-noktaB.y))); | |
} | |
int main(void) | |
{ | |
struct point p1,p2; | |
float Leng; | |
printf("1. Noktanin Koordinatlarini Girin -> "); scanf("%f%f",&p1.x,&p1.y); | |
printf("2. Noktanin Koordinatlarini Girin -> "); scanf("%f%f",&p2.x,&p2.y); | |
// Leng=sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y)); | |
// printf("Uzaklık = %.3f",Leng); | |
Leng=uzaklik(p1,p2); | |
printf("Uzakliklari = %f",Leng); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
struct ogrenci | |
{ | |
char isim[15]; | |
int yas; | |
float ortalama; | |
}; | |
void oku(struct ogrenci s[]); | |
int main(void) | |
{ | |
struct ogrenci sinif[30]; | |
float enbuyuk =0.0; | |
char birinci[15]; | |
int i; | |
oku(sinif); | |
for(i=0;i<5;i++) | |
{ | |
if((sinif[i].ortalama)>enbuyuk) | |
{ | |
enbuyuk=sinif[i].ortalama; | |
strcpy(birinci,sinif[i].isim); | |
} | |
} | |
printf("Sinif birincisi: %s ",birinci); | |
printf("Ortalama: %5.2f",enbuyuk); | |
return 0; | |
} | |
void oku(struct ogrenci s[]) | |
{ | |
int i; | |
for(i=0;i<5;i++) | |
{ | |
scanf("%s,",s[i].isim); | |
scanf("%d %f",&s[i].yas,&s[i].ortalama); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
//kitap örnek final*** | |
int main(int argc, char *argv[]) { | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
char* Row(int); | |
int main(void) | |
{ | |
srand(time(NULL)); | |
int guess=rand()%9000+1000; | |
int life=20,count,Done=0,number; | |
for(count=1;count<=life;count++) | |
{ | |
char *th=Row(count); | |
printf("Enter your %2d%s guess(1000-10000)-> ",count,th); | |
scanf("%d",&number); | |
if(number!=guess) | |
{ | |
if(number<1000 || number >= 10000) | |
{ | |
char *th=Row(count); | |
printf("\nError Unknown range! Retry your %2d%s Guess\n",count,th); | |
count--; | |
continue; | |
} | |
else if(number<guess) | |
printf("Increase your number!\n"); | |
else if(number>guess) | |
printf("Reduce your number!\n"); | |
} | |
else | |
{ | |
Done=1; | |
break; | |
} | |
} | |
if(Done==1) | |
{ | |
char *th=Row(count); | |
printf("\nCongrats! You found the number %2d%s times.\n",count,th); | |
} | |
else | |
printf("\nTry again :(\n"); | |
return 0; | |
} | |
char* Row(int x) | |
{ | |
if(x==1) | |
return("st"); | |
else if(x==2) | |
return("nd"); | |
else if(x==3) | |
return("rd"); | |
else | |
return("th"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
FILE *dosyaYaz; | |
dosyaYaz=fopen("ogrenci.txt","w"); | |
fputs("Ali 82\n",dosyaYaz); | |
fputs("Aysu 97\n",dosyaYaz); | |
fclose(dosyaYaz); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
int mt1,mt2,final,donemNotu; | |
char ad[30]; | |
FILE *dosyaYaz; | |
FILE *dosyaOku; | |
dosyaOku=fopen("ogrenci.txt","r"); | |
dosyaYaz=fopen("notlar.txt","w"); | |
while(fscanf(dosyaOku,"%s %d %d %d\n",&ad,&mt1,&mt2,&final) != EOF) | |
{ | |
donemNotu= (mt1 *0.25)+(mt2*0.25)+(final*0.5); | |
fprintf(dosyaYaz,"%s: %d\n",ad,donemNotu); | |
} | |
fclose(dosyaOku); | |
fclose(dosyaYaz); | |
return(0); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
int mt1,mt2,final,donemNotu; | |
char ad[30]; | |
FILE *dosyaYaz; | |
FILE *dosyaOku; | |
dosyaOku=fopen("ogrenci.txt","r"); | |
dosyaYaz=fopen("notlar.txt","w"); | |
while(fscanf(dosyaOku,"%s %d %d %d\n",&ad,&mt1,&mt2,&final) != EOF) | |
{ | |
donemNotu= (mt1 *0.25)+(mt2*0.25)+(final*0.5); | |
fprintf(dosyaYaz,"%s: %d\n",ad,donemNotu); | |
} | |
fclose(dosyaOku); | |
fclose(dosyaYaz); | |
return(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
21/11/2017 ~~ 19/12/2017