تبلیغات :
ماهان سرور
آکوستیک ، فوم شانه تخم مرغی ، پنل صداگیر ، یونولیت
فروش آنلاین لباس کودک
خرید فالوور ایرانی
خرید فالوور اینستاگرام
خرید ممبر تلگرام

[ + افزودن آگهی متنی جدید ]




نمايش نتايج 1 به 6 از 6

نام تاپيک: درخواست برنامه

  1. #1
    در آغاز فعالیت k 810's Avatar
    تاريخ عضويت
    Dec 2009
    پست ها
    9

    12 درخواست برنامه

    سلام
    ساناز هستم
    اگه كسي ميتونه منو كمك كنه
    خيلي ممنونم
    برنامه اي بنويسيد كه اطلاعات دانشجويان را در يك فايل ذخيره نموده و آنها را مديريت كند.برنامه بايد شامل بخشهاي اضافه كردن دانشجو حذف دانشجو جستجوي دانشجو بر اساس فيلدهاي مختلف ليست گيري از دانشجويان و ويرايش اطلاعات يك دانشجو باشد.

  2. #2
    داره خودمونی میشه
    تاريخ عضويت
    Nov 2008
    محل سكونت
    یزد
    پست ها
    182

    پيش فرض

    سلام
    برنامه به صورت c باشه يا ++c ?

  3. #3
    در آغاز فعالیت k 810's Avatar
    تاريخ عضويت
    Dec 2009
    پست ها
    9

    پيش فرض

    سلام
    برنامه بايد به صورت++ c باشه

  4. #4
    داره خودمونی میشه
    تاريخ عضويت
    Nov 2008
    محل سكونت
    یزد
    پست ها
    182

    پيش فرض

    #include<stdio.h>
    #include<conio.h>
    #include<stdlib.h>
    #include<iostream.h>
    #include<string.h>
    typedef struct {
    char na[10];
    char fa[15];
    long stno;
    float ave;
    }student;
    void add()
    {
    char *s;
    student stu;
    FILE *fp;
    fp=fopen("stu.dat","a");
    if(!fp)
    {
    cout<<"\n can not open file ";
    getch();
    exit(0);
    }
    cout<<"\n enter a name ";
    gets(stu.na);
    cout<<"\n enter a famil ";
    gets(stu.fa);
    cout<<"\n enter a stno ";
    gets(s);
    stu.stno=atol(s);
    cout<<"\n enter a ave ";
    gets(s);
    stu.ave=atof(s);
    fwrite(&stu,sizeof(student),1,fp);
    fclose(fp);
    }
    //*****************
    void list()
    {
    student stu;
    FILE *fp;
    fp=fopen("stu.dat","r");
    if(!fp)
    {
    cout<<"\n can not open file ";
    getch();
    exit(0);
    }
    fread(&stu,sizeof(student),1,fp);
    while(!feof(fp))
    {
    cout<<"\n ";
    cout<<stu.na<<" ";
    cout<<stu.fa<<" ";
    cout<<stu.stno<<" ";
    cout<<stu.ave<<" ";
    fread(&stu,sizeof(student),1,fp);
    }
    fclose(fp);
    }
    //*********************
    void sort()
    {
    student stu[100],temp;
    int i,j,k=0;
    FILE *fp;
    fp=fopen("stu.dat","r+");
    if(!fp)
    {
    cout<<"\n can not open file ";
    getch();
    exit(0);
    }
    fread(stu+k,sizeof(student),1,fp);
    while(!feof(fp))
    {
    k++;
    fread(stu+k,sizeof(student),1,fp);
    }
    for(i=0;i<k;i++)
    for(j=i+1;j<k;j++)
    if(strcmpi(stu[i].fa,stu[j].fa)>0)
    {
    temp=stu[i];
    stu[i]=stu[j];
    stu[j]=temp;
    }
    rewind(fp);
    fwrite(stu,sizeof(student),k,fp);
    fclose(fp);
    }
    //**********************
    void del()
    {
    char *s;
    student stu[100],temp;
    int flag=0,k=0;
    long stno;
    FILE *fp;
    fp=fopen("stu.dat","r");
    if(!fp)
    {
    cout<<"\n can not open file ";
    getch();
    exit(0);
    }
    cout<<"\n enter a stno for del ";
    gets(s);
    stno=atol(s);
    fread(&temp,sizeof(student),1,fp);
    while(!feof(fp))
    {
    if(temp.stno==stno)
    flag=1;
    else
    stu[k++]=temp;
    fread(&temp,sizeof(student),1,fp);
    }
    fclose(fp);
    if(flag==0)
    cout<<"\n not found ";
    fp=fopen("stu.dat","w");
    if(!fp)
    {
    cout<<"\n can not open file ";
    getch();
    exit(0);
    }
    fwrite(stu,sizeof(student),k,fp);
    fclose(fp);
    }
    //*********************
    void update()
    {
    char *s;
    student stu[100],temp;
    int flag=0,k=0;
    long stno;
    FILE *fp;
    fp=fopen("stu.dat","r+");
    if(!fp)
    {
    cout<<"\n can not open file ";
    getch();
    exit(0);
    }
    cout<<"\n enter a stno for update ";
    gets(s);
    stno=atol(s);
    fread(&temp,sizeof(student),1,fp);
    while(!feof(fp))
    {
    if(temp.stno==stno)
    {
    flag=1;
    cout<<"\n enter a new stno ";
    gets(s);
    temp.stno=atol(s);
    }
    stu[k++]=temp;
    fread(&temp,sizeof(student),1,fp);
    }
    rewind(fp);
    if(flag==0)
    cout<<"\n not found ";

    fwrite(stu,sizeof(student),k,fp);
    fclose(fp);
    }
    //********************
    void main()
    {
    clrscr();
    char ch;
    while(1)
    {
    cout<<"\n enter a for add s for";
    cout<<"\n sort l for list u for update d for del";
    ch=getche();
    switch(ch)
    {
    case 'a':
    case'A':
    add();
    list();
    break;
    case 'l':
    case'L':
    list();
    break;
    case 'd':
    case'D':
    del();
    list();
    break;
    case 's':
    case'S':
    sort();
    list();
    break;
    case 'u':
    case'U':
    update();
    list();
    break;
    }
    cout<<" Do you continue? n for no ";
    ch=getche();
    cout<<"\n";
    if(ch=='n' || ch=='N')
    break;
    }
    getch();
    }

  5. #5
    در آغاز فعالیت k 810's Avatar
    تاريخ عضويت
    Dec 2009
    پست ها
    9

    12 آبجي ساناز كمك ميخواد

    سلام
    با تشكر از شما دوست عزيز براي توجه تون
    اين برنامه بايد با++c نوشته بشه
    من اين برنامه رو نوشتم فقط تو قسمت ويرايشش مشكل دارم و نميتونم كاملش كنم
    خيلي ممنونم

  6. #6
    در آغاز فعالیت k 810's Avatar
    تاريخ عضويت
    Dec 2009
    پست ها
    9

    5 كمك كمك كمك

    سلام دوستان
    من اين برنامه رو نوشتم اكه ميشه يكي قسمت ويرايش دانشجو رو برام بنويسه
    خيلي ممنونم
    #include<iostream.h>
    #include<fstream.h>
    #include<conio.h>
    #include<stdlib.h>
    #include<stdio.h>
    #include<string.h>
    struct student{
    char name[20],family[20];
    int year,flag;
    long int id;
    float avg;}std;
    void main()
    {
    int n,m,num,y=6;
    char s[20];
    clrscr();
    ofstream fp("c:\student.dat",ios::out | ios::binary);
    if(!fp){
    cout<<"cannot open file";
    exit(0);}
    cout<<" .::Mohammady Roshan 87222165::. ";
    cout<<"\n .::Student Information::. ";
    cout<<"\n";
    cout<<"\n id ";
    cout<<"name ";
    cout<<"family ";
    cout<<"birthday ";
    cout<<"averag ";
    cout<<"flag ";
    cout<<"\n---------------------------------------------------------------------------";
    while(1){
    gotoxy(1,y);
    cin>>std.id;
    gotoxy(15,y);
    cin>>std.name;
    if(!std.name[0]) break;
    gotoxy(30,y);
    cin>>std.family;
    gotoxy(45,y);
    cin>>std.year;
    gotoxy(60,y);
    cin>>std.avg;
    gotoxy(75,y);
    cin>>std.flag;
    cin.get();
    fp.write((char *) &std,sizeof(struct student));
    y++;
    if(getch()=='#')
    break;
    }
    fp.close();
    cout<<"\nenter any key to go to menu...";
    getch();
    label:clrscr();
    cout<<"1.Insert Student";
    cout<<"\n2.Display Students";
    cout<<"\n3.Remove Student";
    cout<<"\n4.Search Student";
    cout<<"\n5.Edit Student";
    cout<<"\n6.Exit";
    cout<<"\n\nenter num:";
    cin>>num;
    switch(num){
    case 1:{
    clrscr();
    y=4;
    ofstream ins("c:\student.dat",ios::app | ios::binary);
    if(!fp){
    cout<<"cannot open file";
    exit(0);}
    cout<<"\n id ";
    cout<<"name ";
    cout<<"family ";
    cout<<"birthday ";
    cout<<"averag ";
    cout<<"\n---------------------------------------------------------------------------";
    while(1){
    gotoxy(1,y);
    cin>>std.id;
    gotoxy(15,y);
    cin.get(std.name,20);
    if(!std.name[0]) break;
    gotoxy(30,y);
    cin.get(std.family,20);
    gotoxy(45,y);
    cin>>std.year;
    gotoxy(60,y);
    cin>>std.avg;
    gotoxy(75,y);
    cin>>std.flag;
    ins.write((char *) &std,sizeof(struct student));
    y++;
    if(getch()=='#')
    break;
    }
    fp.close();
    goto label;
    }break;
    case 2:{
    clrscr();
    ifstream disp("c:\student.dat",ios::in | ios::binary);
    if(!disp){
    cout<<"cannot open file";
    exit(0);}
    cout<<"\n id ";
    cout<<"name ";
    cout<<"family ";
    cout<<"birthday ";
    cout<<"averag ";
    cout<<"\n---------------------------------------------------------------------------";
    y=4;
    while(disp.read((char *) &std,sizeof(struct student)))
    {
    if(std.flag==0){
    gotoxy(1,y);
    cout<<std.id;
    gotoxy(15,y);
    cout<<std.name;
    gotoxy(30,y);
    cout<<std.family;
    gotoxy(45,y);
    cout<<std.year;
    gotoxy(60,y);
    cout<<std.avg;
    getch();
    y++;
    }}
    disp.close();
    goto label;
    }break;
    case 3:{
    clrscr();
    y=4;
    ifstream ins("c:\student.dat",ios::app | ios::binary);
    if(!fp){
    cout<<"cannot open file";
    exit(0);}
    cout<<"Remove student by id enter(1) ;by name enter(2) ;by family enter(3) ;& go to meno(#) :";
    cin>>m;
    while(ins.read((char *) &std,sizeof(struct student)))
    {
    if(m==1)
    {
    cout<<"enter id:";
    cin>>n;
    if(std.id==n&&std.flag==0)
    std.flag=1;
    }
    if(m==2)
    {
    cout<<"enter name:";
    cin>>s;
    if(strcmp(std.name,s)==0&&std.flag==0)
    std.flag=1;
    }
    if(m==3)
    {
    cout<<"enter family:";
    cin>>s;
    if(strcmp(std.family,s)==0&&std.flag==0)
    std.flag=1;
    }}
    ins.close();
    goto label;
    }break;
    case 4:{
    ifstream search("c:\student.dat",ios::in | ios::binary);
    if(!fp){
    cout<<"cannot open file";
    exit(0);}
    cout<<"search id enter(1) ;name enter(2) ;family enter(3):";
    cin>>m;
    y=14;
    while(search.read((char *) &std,sizeof(struct student)))
    {
    if(m==1)
    {
    cout<<"enter id:";
    cin>>n;
    if(std.id==n&&std.flag==0)
    {
    cout<<"\n id ";
    cout<<"name ";
    cout<<"family ";
    cout<<"birthday ";
    cout<<"averag ";
    cout<<"\n---------------------------------------------------------------------------";
    gotoxy(1,y);
    cout<<std.id;
    gotoxy(15,y);
    cout<<std.name;
    gotoxy(30,y);
    cout<<std.family;
    gotoxy(45,y);
    cout<<std.year;
    gotoxy(60,y);
    cout<<std.avg;
    getch();
    y++;
    }
    }
    else if(m==2)
    {
    cout<<"enter name:";
    cin>>s;
    if(strcmp(std.name,s)==0&&std.flag==0)
    {
    cout<<"\n id ";
    cout<<"name ";
    cout<<"family ";
    cout<<"birthday ";
    cout<<"averag ";
    cout<<"\n---------------------------------------------------------------------------";
    gotoxy(1,y);
    cout<<std.id;
    gotoxy(15,y);
    cout<<std.name;
    gotoxy(30,y);
    cout<<std.family;
    gotoxy(45,y);
    cout<<std.year;
    gotoxy(60,y);
    cout<<std.avg;
    getch();
    y++;
    }
    }
    else if(m==3)
    {
    cout<<"enter family:";
    cin>>s;
    if(strcmp(std.family,s)==0&&std.flag==0)
    {
    cout<<"\n id ";
    cout<<"name ";
    cout<<"family ";
    cout<<"birthday ";
    cout<<"averag ";
    cout<<"\n---------------------------------------------------------------------------";
    gotoxy(1,y);
    cout<<std.id;
    gotoxy(15,y);
    cout<<std.name;
    gotoxy(30,y);
    cout<<std.family;
    gotoxy(45,y);
    cout<<std.year;
    gotoxy(60,y);
    cout<<std.avg;
    getch();
    y++;
    }
    }
    }
    cout<<"\nend search";
    search.close();
    goto label;
    }break;
    case 5:{
    clrscr();
    cout<<"good bay";
    exit(0);
    }break;
    }


    getch();
    }

Thread Information

Users Browsing this Thread

هم اکنون 1 کاربر در حال مشاهده این تاپیک میباشد. (0 کاربر عضو شده و 1 مهمان)

User Tag List

قوانين ايجاد تاپيک در انجمن

  • شما نمی توانید تاپیک ایحاد کنید
  • شما نمی توانید پاسخی ارسال کنید
  • شما نمی توانید فایل پیوست کنید
  • شما نمی توانید پاسخ خود را ویرایش کنید
  •