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 

کمک فوری(ساختار)

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


Joined: 09 Dec 2006
Posts: 31

PostPosted: Sun Feb 04, 2007 12:27 pm    Post subject: کمک فوری(ساختار) Reply with quote

بنویسید که در آن یک ساختار با دو فیلد تعریف شده با شد یک فیلد آن یک رشته و فیلد دیگر آن یک آرایه از رشته ها باشد برنامه ای
سپس متغیری از نوع این ساختار تعریف کنید روی آن مقدار دهی هنگام تعریف را انجام دهید و سپس این متغیر را چاپ کنید
Back to top
su-30mk
مهمون يكي دو روزه


Joined: 16 Dec 2006
Posts: 12

PostPosted: Sun Feb 25, 2007 9:34 am    Post subject: Reply with quote

#include <stdio.h>
#include <conio.h>
typedef struct
{
   char name[50];
   char family[3][50];

}air;
void main()
{
   air su={ {"Su-30MK"},   //name
          {"Russia",      //family[0]
         "Airforce",   //family[1]
         "uopn f-22 U.S"//faily[2]
          }

        };
   clrscr();
   printf("\nname = %s\tfamily[0] = %s \n\t\tfamily[1] = %s ",su.name,su.family[0],su.family[1]);
   printf("\n\t\tfamily[2] = %s",su.family[2]);
   getch();
}
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