ParsX.com
پذیرش پروژه از دانشجویی ... تا سازمانی 09376225339
 
   ProfileProfile   Log in to check your private messagesLog in to check your private messages  |  FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups Log inLog in   RegisterRegister 

دیتا بیس کوچولو در c

 
Post new topic   Reply to topic    ParsX.com Forum Index -> C/C++ Programming
View previous topic :: View next topic  
Author Message
ali_a
مهمون يكي دو روزه


Joined: 24 Aug 2006
Posts: 22

PostPosted: Thu Aug 24, 2006 1:13 pm    Post subject: دیتا بیس کوچولو در c Reply with quote

سلام به اقا وحید و ارش خان - بابا برا این رجیستر شدن پدرمون در اومد - یه رکورد دانشجویی برا مبارک باش شروع مجدد سایت پیشکش به ارش و وحید - راستی تو اخرین پست ارش دستور system تو زبون c تحت توربو جواب نمیده اصلا خروجی نمیده یه فکری کن اقا ارش - به علی موسوی هم سلام برسونید

//////////// by:M.a alipour
//////////// E-mail: quantum_a7@yahoo.com
////////////////////// reason for using CIN.GET() in this program is_
//////////////////-->  problem on C functions(for string)
#include<conio.h>
#include<iostream.h>
#include<stdio.h>
#include<string.h>
# define n 30
# define unit 140
# define max 10
struct student {
          char fname[n];
          char lname[n];
          char stno[n];
          char course[n];
          long int id;
          int pass_u;
          int term;
          float average ;
          } st[max];

int menu();
void enter(int);
void entergrade(int);
void delete1(int);
void list(int);
void change(int);
int main()
{
clrscr();
textbackground(LIGHTBLUE);
textcolor(WHITE);

for(int i=0;i<max;i++)
    {
    strcpy(st[i].fname,NULL);
    strcpy(st[i].lname,NULL);
    strcpy(st[i].stno,NULL);
    strcpy(st[i].course,NULL);
    st[i].id=0;
    st[i].pass_u=0;
    st[i].average=0.0;
    st[i].term=0;
    }
int select,maincount=0,flag=1;
while(flag)
    {
    select=0;
    select=menu();
    switch(select){
       case(1):{
          enter(maincount);
          ++maincount;
          break;
          }
       case(2):{
          entergrade(maincount);
          break;
          }
       case(3):{
          delete1(maincount);
          --maincount;
          break;
          }
       case(4):{
          list(maincount);
          break;
          }
       case(5):{
          change(maincount);
          break;
          }
       case(6):{
          flag=0;
          cout<<"\n\n\n\t\t\t thank for choose this program";
          for (int j=0;j<500;j++)
            cout<<"\a";
             getch();
             return(0);
             }
       default:  {
          cout<<"\n\nyou enter illegal operation";
          cout<<"\n\nplease try again";
          getch();
          break;
            }
          }
       }
return(0);
}
/////////////////
int menu()
{
int num;
clrscr();
textbackground(LIGHTBLUE);
textcolor(WHITE);
printf("\n\nÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ   MENU    ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ\n");
gotoxy(10,4);
printf("--------------- (1) enter student:");
gotoxy(10,5);
printf("--------------- (2) enter unit and unit number of st.:");
gotoxy(10,6);
printf("--------------- (3) delete student:");
gotoxy(10,7);
printf("--------------- (4) list all:");
gotoxy(10,8);
printf("--------------- (5) change properties:");
gotoxy(10,9);
printf("--------------- (6) exit:");
gotoxy(10,13);
printf("ÛÛÛÛÛÛÛÛÛ    SELECT NUMBER (1-6)::");
scanf("%d",&num);
return(num);
}
/////////////
void enter(int maincount_e)
{
clrscr();
textbackground(LIGHTBLUE);
textcolor(WHITE);
printf("×××××× your list has %d person now ××××××\n",maincount_e);
if(maincount_e<max)
      {
      printf("\nenter first name(st %d):",maincount_e+1);
      cin.get(st[maincount_e].fname,n);
      cin.get();
      printf("\nenter last name(st %d):",maincount_e+1);
      cin.get(st[maincount_e].lname,n);
      cin.get();
      printf("\nenter course(st %d):",maincount_e+1);
      cin.get(st[maincount_e].course,n);
      cin.get();
      printf("\nenter student number(st %d):",maincount_e+1);
      cin.get(st[maincount_e].stno,n);
      printf("\nenter student ID(st %d):",maincount_e+1);
      scanf("%ld",&st[maincount_e].id);
      cin.get();
      }
else  {
      printf("!!!!!!!!!!!! your memory is full !!!!!!!!!!!!!");
      printf("\nyou must delete some student");
      }
}
////////////////
void entergrade(int maincount_eg)
{
int stu;
clrscr();
textbackground(LIGHTBLUE);
textcolor(WHITE);
printf("********************* enter sub course of student *******************\n");
printf("notice: you have %d student in database",maincount_eg);
cout<<endl;
printf("which student do you want select for complete her(his) properties?=");
scanf("%d",&stu);
--stu;
printf("\n-- you choose ---> ");
cout<<st[stu].fname<<"  "<<st[stu].lname;
printf("\nenter term of this student=");
scanf("%d",&st[stu].term);
printf("\nhow many unit student passed?=");
scanf("%d",&st[stu].pass_u);
printf("\nenter his(her) average=");
cin>>st[stu].average;
}

////////////
void delete1(int maincount_d)                        quantum_a7@yahoo.com
{
int del,i;
clrscr();
textbackground(LIGHTBLUE);
textcolor(WHITE);
printf("========================== wellcome to delete menu ==========================");
printf("\nyou have %d student in database",maincount_d);
printf("\n\n\nwhich of the student do you want be deleted ?::");
scanf("%d",&del);
if(del>maincount_d)
      {
      printf("!!!!!!!!  illegal number   !!!!!!!!!!");
      goto END;
      }
cout<<"\n\tyou choose "<<st[del].fname<<"   "<<st[del].lname<<"   for delete";
del-=1;
for(i=del;i<max;i++)
   {
   strcpy(st[i].fname,st[i+1].fname);
   strcpy(st[i].lname,st[i+1].lname);
   st[i].id=st[i+1].id;
   st[i].pass_u=st[i+1].pass_u;
   st[max].pass_u=NULL;
   st[i].term=st[i+1].term;
   st[max].term=NULL;
   strcpy(st[i].course,st[i+1].course);
   strcpy(st[i].stno,st[i+1].stno);
   strcpy(st[max].fname,NULL);
   strcpy(st[max].lname,NULL);
   strcpy(st[max].course,NULL);
   st[14].id=NULL;
   strcpy(st[14].stno,NULL);
   st[i].average=st[i+1].average;
   st[max].average=NULL;
   }
printf("\n\t\t\tdelete complete");
END:getch();
}
///////////
void list(int maincount_l)
{
int r=8,j;
clrscr();
textbackground(LIGHTBLUE);
textcolor(WHITE);
printf("       *******************************************************************");
printf("\n            ²²²² names is data base is =%d 's person ²²²²\n",maincount_l);
printf("É");
for(int i=0;i<77;i++)
 printf("Í");
 printf("»\n");
 printf("Ì");
for(i=0;i<77;i++)
 printf("Í");
printf("¹");
printf("\nÌ   NAME   Î  FAMILY  Π  ID   Î  STUDENT NU. Î COURSE Î TERM Î PASS_U Π AVE ¹");
printf("\nÌ");
for(i=0;i<77;i++)
 printf("Í");
printf("¹");
// end template
for(i=0;i<maincount_l;i++)
     {
     gotoxy(1,r);
     printf("(%d)",i+1);
     //------------------
     gotoxy(4,r);
     puts(st[i].fname);
     gotoxy(15,r);
     puts(st[i].lname);
     gotoxy(27,r);
     printf("%d",st[i].id);
     gotoxy(35,r);
     puts(st[i].stno);
     gotoxy(50,r);
     puts(st[i].course);
     gotoxy(60,r);
     printf("%d",st[i].term);
     gotoxy(68,r);
     printf("%d",st[i].pass_u);
     gotoxy(75,r);
     printf("%4.2f",st[i].average);
     ++r;
     }
 printf("\nÌ");
for(i=0;i<77;i++)
 printf("Í");
printf("¹");
printf("\n      *******************************************************************");
getch();
}
/////////////////
void change(int maincount_c)
{
int chng;
clrscr();
textbackground(LIGHTBLUE);
textcolor(WHITE);
printf("******************** you have %d person in your data base ***************",maincount_c);
printf("\nwhich of student do you want change(?)=");
scanf("%d",&chng);
chng-=1;
if(chng<maincount_c) {
           strcpy(st[chng].fname,NULL);
           strcpy(st[chng].lname,NULL);
           strcpy(st[chng].stno,NULL);
           strcpy(st[chng].course,NULL);
           st[chng].id=NULL;
           st[chng].pass_u=NULL;
           st[chng].term=NULL;
           st[chng].average=NULL;
           cin.get();
           printf("(new) first name=");
           cin.get(st[chng].fname,n);
           cin.get();
           printf("\n(new) last name=");
           cin.get(st[chng].lname,n);
           cin.get();
           printf("\n(new) stno=");
           cin.get(st[chng].stno,n);
           cin.get();
           printf("\n(new) course=");
           cin.get(st[chng].course,n);
           cin.get();
           printf("\n(new) id=");
           scanf("%d",&st[chng].id);
           printf("\n(new) passed units=");
           scanf("%d",&st[chng].pass_u);
           printf("\n(new) average=");
           cin>>st[chng].average;
           printf("\n(new) term=");
           scanf("%d",&st[chng].term);
           printf("\n\t\t your change is complete");
           }
else
     printf("\n XXXXXX  error --> illegal number (try again)");
}
///////////



Back to top
arash
مدير بخش سي
مدير بخش سي


Joined: 27 Nov 2004
Posts: 1232
Location: www.parsx.com

PostPosted: Fri Aug 25, 2006 8:19 pm    Post subject: Reply with quote

مرسی علی جان دستت درد نکنه
در مورد رجیستر کردن با مدیر سایت صحبت کردم انشا الله درست می شه( گم مخور )
در مورد اون دستور " system " هم که من نوشته بودم باید دستوراتی رو که می خوای بنویسی بعد کامپایل کنی
فقط خود فایل exe اون اعمال رو انجام می ده
علی رو هم اگه عکسش رو دیدم چشم حتما بهش سلام می رسونم


Last edited by arash on Sat Aug 26, 2006 10:55 pm; edited 2 times in total
Back to top
vahid
بي تو هرگز


Joined: 26 Nov 2004
Posts: 3067
Location: Tehran

PostPosted: Sat Aug 26, 2006 4:03 pm    Post subject: Reply with quote

سلام . خوش آمدي ...
در باب ثبت نام هركه طاووس خواهد جور هندوستان كشد ... Wink
Back to top
Display posts from previous:   
Post new topic   Reply to topic    ParsX.com Forum Index -> C/C++ Programming All times are GMT + 3.5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum