GodMaster
جمعه 23 دی 1390, 13:55 عصر
سلام دوستان
اين برنامه رو نوشتم اما براي نمايش مبلقژغ همش صفر نشون ميد
مرتب مي كنه اما حقوق رو نشون نميده جلوش
لطفا راهنمايي كنيد
ممنون
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include<string.h>
#define MAX 100
struct karmand {
char name[10] ;
int Hoghoogh;
} st[MAX];
int main(void)
{
int i,j,r;
for(i=0;i<20 ;i++)
{
printf("\n\t enter name:") ;
gets(st[i].name) ;
printf("\n\tenter mony:") ;
gets(st[i].Hoghoogh) ;
}
printf("\n\t please press any key to continue ") ;
getch();
clrscr();
r = 1;
gotoxy(25,r);
printf(" << all the info in list are: >>");
gotoxy(6,r+2);
printf(" name mony ");
gotoxy(6,r+3);
printf(" ________ ________ ");
r = 4;
for(j = 0; j < 20; ++j)
{
gotoxy(14,r);
printf("%s ", st[j].name) ;
gotoxy(26,r);
printf("%u ", st[j].Hoghoogh) ;
r++ ;
}
printf("\n\t please press any key to continue ") ;
getch();
clrscr();
{
int i,j;
char name2[30];
struct karmand st1={0};
for(i=19;i>0;i--){
for(j=0;j<i;j++)
if(strcmp(st[j].name,st[j+1].name)>0){
st1=st[j];
st[j]=st[j+1];
st[j+1]=st1;
}
}}
r = 1;
gotoxy(25,r);
printf(" << all the info in list are: >>");
gotoxy(6,r+2);
printf(" name mony ");
gotoxy(6,r+3);
printf(" ________ ________ ");
r = 4;
for(j = 0; j < 20; ++j)
{
gotoxy(14,r);
printf("%s ", st[j].name) ;
gotoxy(26,r);
printf("%u ", st[j].Hoghoogh) ;
(r) ++ ;
}
printf("\n\t please press any key to continue ") ;
getch();
return;
}
اين برنامه رو نوشتم اما براي نمايش مبلقژغ همش صفر نشون ميد
مرتب مي كنه اما حقوق رو نشون نميده جلوش
لطفا راهنمايي كنيد
ممنون
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include<string.h>
#define MAX 100
struct karmand {
char name[10] ;
int Hoghoogh;
} st[MAX];
int main(void)
{
int i,j,r;
for(i=0;i<20 ;i++)
{
printf("\n\t enter name:") ;
gets(st[i].name) ;
printf("\n\tenter mony:") ;
gets(st[i].Hoghoogh) ;
}
printf("\n\t please press any key to continue ") ;
getch();
clrscr();
r = 1;
gotoxy(25,r);
printf(" << all the info in list are: >>");
gotoxy(6,r+2);
printf(" name mony ");
gotoxy(6,r+3);
printf(" ________ ________ ");
r = 4;
for(j = 0; j < 20; ++j)
{
gotoxy(14,r);
printf("%s ", st[j].name) ;
gotoxy(26,r);
printf("%u ", st[j].Hoghoogh) ;
r++ ;
}
printf("\n\t please press any key to continue ") ;
getch();
clrscr();
{
int i,j;
char name2[30];
struct karmand st1={0};
for(i=19;i>0;i--){
for(j=0;j<i;j++)
if(strcmp(st[j].name,st[j+1].name)>0){
st1=st[j];
st[j]=st[j+1];
st[j+1]=st1;
}
}}
r = 1;
gotoxy(25,r);
printf(" << all the info in list are: >>");
gotoxy(6,r+2);
printf(" name mony ");
gotoxy(6,r+3);
printf(" ________ ________ ");
r = 4;
for(j = 0; j < 20; ++j)
{
gotoxy(14,r);
printf("%s ", st[j].name) ;
gotoxy(26,r);
printf("%u ", st[j].Hoghoogh) ;
(r) ++ ;
}
printf("\n\t please press any key to continue ") ;
getch();
return;
}