من كلا مخالف حل پروژه هاي بقيه هستم.
چون وقتتون كمه بر خلاف ميلم...
کد:
#include<stdio.h>
#include<conio.h>
#define max 100
#include<stdlib.h>
void del(void);
int menu(void);
int addst(int);
void outst(int);
void quit(void);
struct student{
char number[50];
char name[50];
char familyname[50];
int mash;
}st[max];
main(){
int x=0;
char choice;
while(1){
choice=menu() ;
switch(choice){
case '1': x=addst(x);
break;
case '2':outst(x);
break;
case '3':del();
break;
case '4':quit();
break;
}
}
return 0;
}
//////////////
int addst(int x )
{
char c[10];
int count;
int counter=0;
int static y;
clrscr();
printf("number of student:");
scanf("%d",&count);
y=count;
while(count--){
gotoxy(25,2);
printf("*****************************\n");
printf("enter for %d student\n\n",counter+1);
printf("enter number :");
gotoxy(30,5);
scanf("%s",&st[counter].number);
printf("mash?(y/n)");
gotoxy(30,6);
if(getche()=='y') st[counter].mash=1;
else st[counter].mash=0;
gets(c); //// alakiiiiiiiiiiiiiii
printf("\n");
printf("enter name:");
gotoxy(30,7);
gets(st[counter].name);
printf("family name:\n");
gotoxy(30,8);
gets(st[counter].familyname);
clrscr();
counter++;
}
return y;
}
/////////////
void outst(int x)
{
int count;
int counter=0;
count=x;
clrscr();
while(count--){
printf("%d student\n", counter+1);
printf(" number student is %s\n",st[counter].number);
if(st[counter].mash)
printf(" mashroot\n");
printf(" name of student is: %s\n",st[counter].name);
printf(" family name is: %s\n",st[counter].familyname);
counter++;
printf("\n\n");
}
getch();
}
/////////////
int menu(void){
char y;
clrscr();
gotoxy(30,1);
printf("****Welcome****");
gotoxy(1,2);
printf("Enter your choice");
gotoxy(1,3);
printf("1: add student") ;
gotoxy(1,4);
printf("2: show students that are add");
gotoxy(1,5);
printf("3: delete");
gotoxy(1,6);
printf("4: exit");
gotoxy(1,7);
y=getch();
return y;
}
/////////////
void quit(void){
printf("thanks for used");
getch();
exit(1);}
/////////////
void del(void){
int x;
printf("Enter the number that u want delete");
scanf("%d",&x);
if(x>-1 && x<101) {
x--;
st[x].name[0]='\0';
st[x].number[0]='\0';
st[x].familyname[0]='\0';
st[x].mash='\0';
}
}
ببين چه قدرش به كارت مياد.
موفق باشي.