sahar.d72
یک شنبه 04 دی 1390, 22:17 عصر
سلام این برنامه رو با c نوشتم اما error میده
کسی میتونه کمک کنه؟؟؟
#include <stdio.h>
#include <stdlib.h> //tolide adade tasadofi dar rand
#define I 9
#define J 3
//function prototypes
int binarySearch(const int a[][1],int searchkey,int low,int high);
void printHeader();
void insertionSort(int a[][1],int I);
void printPass(int a[][1], int I);
int a[I][J];
char vaziat;
int stdno;
char name;
char a[16][0]=name; //namo name khanevadegi ba 15 char English va chare pooche payani
int a[I][1]=key; //kode melli
char a[I][2]=vaziat; //vaziat
int a[I][3]=stdno; //shomare daneshjui
int main()
{
printf("amaliate morede nazar ra entekhab konid\n");
printf("1:namayeshe liste moshakhaste daneshjuyan\n");
printf("2:jostejuye daneshju\n");
while(amaliat=getchar()) != EOF)//while1
{
switch(amaliat){//switch1
case '1':
//moshakhasate yek daneshjuye farzi
char a[0][0]="Mina Alavi"
int a[0][1]={1275434466}
char a[0][2]="Roozane"
int a[0][3]={9023455}
for(I=0; I<10; I++){
while (J<=3){
printf("%p", a[I][J]);
J++;
}//end while
}//end for
break;
case '2':
void insertionSort (int a[][1], int I) //sort bar asase kode melli
{
int insert; //temporary variable to hold element insert
int I;
for(i=1;i<I; i++){
int moveItem=I;
insert=a[i][1];
while (moveItem>0 && a[moveItem-1][1]>insert){
a[moveItem]=a{moveItem-1];
--moveItem;
}//end while
a[moveItem][1]= insert;
a[moveItem]=insert; //place inserted element
printPass( a,I,I,moveItem);
}//end for
}//end function insertionSort
int i;
int key;
int result;
for(i=0; i<I;i++)
{
a[i]=2*i
}
printf("kode mellie daneshju ra vared konid");
scanf("%d", &key);
printHeader();
result=binarySearch(a,key,0,I);
if(result != -1){
printf("\n %d found in array element %d\n", key, result);
printf("\n vaziate daneshju : ");
printf("%s", a[result][2]);
}
else{
printf("\n %d yaft nashod\n", key);
printf("sabte nam mikonid? \n baraye sabte nam kelide 1 va baraye khoruj kelide 2 ra feshar dahid.");
while((kelid=getchar()) != EOF){//while2
switch(kelid){//switch2
case '1':
stdno=rand()
printf("\n shomareye daneshjui : %d", stdno);
printf("name daneshju ra vared konid:\n");
scanf("%s", name);
printf("vaziat? Roozane – amoozeshe electronic\n");
scanf("%s", &vaziat);
printf("sabte name %s ba kode mellie %d va shomare daneshjuie %d ba movafaghiat anjam shod\n vaziat: %s", name, key, stdno, vaziat);
case '2';
return -1; //exit
}//end switch2
}//end while2
}//end switch1
}//end while1
}//end main
کسی میتونه کمک کنه؟؟؟
#include <stdio.h>
#include <stdlib.h> //tolide adade tasadofi dar rand
#define I 9
#define J 3
//function prototypes
int binarySearch(const int a[][1],int searchkey,int low,int high);
void printHeader();
void insertionSort(int a[][1],int I);
void printPass(int a[][1], int I);
int a[I][J];
char vaziat;
int stdno;
char name;
char a[16][0]=name; //namo name khanevadegi ba 15 char English va chare pooche payani
int a[I][1]=key; //kode melli
char a[I][2]=vaziat; //vaziat
int a[I][3]=stdno; //shomare daneshjui
int main()
{
printf("amaliate morede nazar ra entekhab konid\n");
printf("1:namayeshe liste moshakhaste daneshjuyan\n");
printf("2:jostejuye daneshju\n");
while(amaliat=getchar()) != EOF)//while1
{
switch(amaliat){//switch1
case '1':
//moshakhasate yek daneshjuye farzi
char a[0][0]="Mina Alavi"
int a[0][1]={1275434466}
char a[0][2]="Roozane"
int a[0][3]={9023455}
for(I=0; I<10; I++){
while (J<=3){
printf("%p", a[I][J]);
J++;
}//end while
}//end for
break;
case '2':
void insertionSort (int a[][1], int I) //sort bar asase kode melli
{
int insert; //temporary variable to hold element insert
int I;
for(i=1;i<I; i++){
int moveItem=I;
insert=a[i][1];
while (moveItem>0 && a[moveItem-1][1]>insert){
a[moveItem]=a{moveItem-1];
--moveItem;
}//end while
a[moveItem][1]= insert;
a[moveItem]=insert; //place inserted element
printPass( a,I,I,moveItem);
}//end for
}//end function insertionSort
int i;
int key;
int result;
for(i=0; i<I;i++)
{
a[i]=2*i
}
printf("kode mellie daneshju ra vared konid");
scanf("%d", &key);
printHeader();
result=binarySearch(a,key,0,I);
if(result != -1){
printf("\n %d found in array element %d\n", key, result);
printf("\n vaziate daneshju : ");
printf("%s", a[result][2]);
}
else{
printf("\n %d yaft nashod\n", key);
printf("sabte nam mikonid? \n baraye sabte nam kelide 1 va baraye khoruj kelide 2 ra feshar dahid.");
while((kelid=getchar()) != EOF){//while2
switch(kelid){//switch2
case '1':
stdno=rand()
printf("\n shomareye daneshjui : %d", stdno);
printf("name daneshju ra vared konid:\n");
scanf("%s", name);
printf("vaziat? Roozane – amoozeshe electronic\n");
scanf("%s", &vaziat);
printf("sabte name %s ba kode mellie %d va shomare daneshjuie %d ba movafaghiat anjam shod\n vaziat: %s", name, key, stdno, vaziat);
case '2';
return -1; //exit
}//end switch2
}//end while2
}//end switch1
}//end while1
}//end main