Ceriwis

Ceriwis (https://forum.ceriwis.com/forum.php)
-   Programming (https://forum.ceriwis.com/forumdisplay.php?f=63)
-   -   mohon bantuin...benerin program!!!~ (https://forum.ceriwis.com/showthread.php?t=538852)

Braincode 11th November 2011 02:11 PM

mohon bantuin...benerin program!!!~
 

#include

#include

#include



void menu();

void lagrange();

void hitung_l();

void polinom();



double x[10], y[10], l[10], z, p;

int n,i,j;

int main(int argc, char *argv[])





void menu()

{

int pilihan;

textcolor(LIGHTRED);

gotoxy(25,4);printf(".-------------------------------.\n");

gotoxy(25,5);printf("| ");textcolor(YELLOW);printf("MENU UTAMA");textcolor(LIGHTRED);printf(" |\n");

gotoxy(25,6);printf("|-------------------------------|\n");

gotoxy(25,7);printf("| | |\n");

gotoxy(25,8);printf("| ");textcolor(LIGHTMAGENTA);printf("1");textcol or(L IGHTRED);printf(" | ");textcolor(LIGHTGREEN);printf("ORDE 1 ");textcolor(LIGHTRED);printf(" |\n");

gotoxy(25,9);printf("| | |\n");

gotoxy(25,10);printf("| ");textcolor(LIGHTMAGENTA);printf("2");textcol or(L IGHTRED);printf(" | ");textcolor(LIGHTGREEN);printf("ORDE 2 ");textcolor(LIGHTRED);printf(" |\n");

gotoxy(25,11);printf("| | |\n");

gotoxy(25,12);printf("| ");textcolor(LIGHTMAGENTA);printf("3");textcol or(L IGHTRED);printf(" | ");textcolor(LIGHTGREEN);printf("ORDE 3 ");textcolor(LIGHTRED);printf(" |\n");

gotoxy(25,13);printf("| | |\n");

gotoxy(25,14);printf("| ");textcolor(LIGHTMAGENTA);printf("4");textcol or(L IGHTRED);printf(" | ");textcolor(LIGHTGREEN);printf("0RDE 4 ");textcolor(LIGHTRED);printf(" |\n");

gotoxy(25,15);printf("| | |\n");

gotoxy(25,16);printf("| ");textcolor(LIGHTMAGENTA);printf("5");textcol or(L IGHTRED);printf(" | ");textcolor(LIGHTGREEN);printf("ORDE 5 ");textcolor(LIGHTRED);printf(" |\n");

gotoxy(25,17);printf("| | |\n");

gotoxy(25,18);printf("| ");textcolor(LIGHTMAGENTA);printf("0");textcol or(L IGHTRED);printf(" | ");textcolor(LIGHTGREEN);printf("KELUAR");text colo r(LIGHTRED);printf(" |\n");

gotoxy(25,19);printf("| | |\n");

gotoxy(25,20);printf("|-------------------------------|\n");

gotoxy(25,21);printf("| Masukkan Pilihan Anda | |\n");

gotoxy(25,22);printf(" \\_____________________________/\n");

textcolor(LIGHTCYAN);

gotoxy(53,21);scanf("%i",&pilihan);



switch (pilihan)

{

case 1 : clrscr();n=1;lagrange();

case 2 : clrscr();n=2;lagrange();

case 3 : clrscr();n=3;lagrange();

case 4 : clrscr();n=4;lagrange();

case 5 : clrscr();n=5;lagrange();

case 0 : exit(0);

}



while ((pilihan5))

{

gotoxy(10,24);printf(" Pilihan yang anda masukkan salah, harap ULANGI!!!");getch();

clrscr();

menu();

}



}



void lagrange()

{

printf("Masukan Nilai x :"); scanf("%f", &z);

for(i=0;i=n;i++)

{

printf("x[%d] : ",i);scanf("%f", &x[i]);

printf("y[%d] : ",i);scanf("%f", &y[i]);

}

hitung_l();

polinom();



}



void hitung_l()

{

for(i=0;i=n;i++)

{

l[i]=1;

for(j=0;j=n;j++)

{

if(i!= j)

{

l[i]=l[i]*(z-x[j])/(x[i]-x[j]);

}

printf("l[%i] = %4f\n", i,l[i]);



}

}

for(i=0;i=n;i++)

{



}

}





void polinom()

{

p=0;

for(i=0;i=n;i++)

{

p=p+(y[i]*l[i]);

}

printf("Nilai P : %3f\n",p);

}



itu source codenya gan...

tpi yang blum jalan nilai p nya gan...

buat agan2 programmer mohon bntuannya...

</div>


All times are GMT +7. The time now is 01:42 AM.