Log in

View Full Version : [HELP] Tolong cekin kodingan ane please


JagoVB
20th November 2011, 11:27 AM
Gan, ane abis nyoba2 ngoding pake bahasa C, tapi hasilnya aneh... Dibawah ane lampirin source code yang ane bikin... mungkin agan2 ada yang bisa memperbaiki sedikit kesalahan ane...



<div style="margin:20px; margin-top:5px">
Code:

#include
#include
#include
#include

void gotoxy(int x, int y)
{
COORD point;
point.X = x;
point.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_H ANDLE), point);
}

void main()
{
int select,count;
char nama[50][50], avg[50][50], play[50][50], file[50][100];
FILE *in;
FILE *out;

do
{
system("cls");
printf("Score Record DotA Player\n========================\n1. View Player\n2. Add player record\n3. Add new player\n4. Delete player\n5. Save and Exit\n\n");
do
{
printf("Your choice : ");scanf("%d",&select);fflush(stdin);
}
while(select5);
switch(select)
{
case 1:
system("cls");
printf(" Player Name");gotoxy(18,0);printf("| Average Score");gotoxy(36,0);printf("| Number of Playing\n");
printf("================================================== =====\n");
count=0;
out=fopen("soal09.txt","r");
while(feof(out))
{
fgets(file[count],100,out);
fgetc(out);
strcpy(nama[count],strtok(file[count]," "));
strcpy(avg[count],strtok(NULL," "));
strcpy(play[count],strtok(NULL," "));
count++;
printf(" %s",nama[count]);gotoxy(18,count+2);printf("| %s",avg[count]);gotoxy(36,count+2);printf("| %s",play[count]);
}
fclose(out);
printf("Press ENTER to continue...");
getchar();
break;
}
}
while(select>=1&&select