پس باید از کامپایلرهایی مثل برلند استفاده کنید
توی کامپایلر های جدید باید main حتما int برگردونه
پس باید از کامپایلرهایی مثل برلند استفاده کنید
توی کامپایلر های جدید باید main حتما int برگردونه
با سلام خدمت اساتید گرامی
آقا من یه جایی از این مساله رو متوجه نمیشم.اگه کسی کمکم کنه ممنون میشم.از کتاب آقای قمی هستش
"برنامه ای که تعدادی مقادیر صحیح را از ورودی بگیرد و در آرایه ای قرار دهد.سپس توسط تابعی کوچکترین عنصر و محل وجود آن را پیدا کند.(حداکثر تعداد اعداد 20 است).آخرین عدد ورودی صفر است
من متوجه نمی شم این; --size چه کاری انجام میده.اگه لطف کنید مساله رو تشریح کنید ممنون میشم
کد:برای مشاهده محتوا ، لطفا وارد شوید یا ثبت نام کنید
توی مسئله گفته شده آخرین عدد ورودی صفر است، یعنی باید صفر رو به منزله ی پایان حلقه بدونه، بنابراین شما باید اینقد عدد بگیرید تا زمانی که به صفر برسید،زمانی که شما صفر رو وارد میکنید این شرط اجرا میشه، اینجاست که برابر با صفره و از حلقه خارج میشه
حالا اینجا اگه size رو -- نکنی صفر هم که توی آرایه به عنوان آخرین عدد وارد شده توی حلقه در تابع findmin چک میشه ، و چون صفر از همه کوچیکتره بنابراین همیشه برنامه شما جواب صفر میده
در ضمن میتونی جاش اینجوری بنویسی
و size-- رو برداریکد:برای مشاهده محتوا ، لطفا وارد شوید یا ثبت نام کنید![]()
شما خیلی راحت با بر داشتن همون قسمت size-- و امتحان برنامه متوجه میشید که جواب برنامه همیشه عدد 0 میشه
اون هم به این خاطر که آخرین عدد آرایه عدد 0 قرار میگیره پس برای اینکه برنامه آخرین عدد رو در نظر نگیره یکی از مقدار size کم میکنیم
**************************
دوستان من تاپیک مربوط به سوالات C# رو پیدا نمی کنم
(انقدر دوستان واسه هر سوالشون یه تاپیک باز کردن این بخش پر تاپیک های تک پستی یا تک صفحه ای شده)
من چون دارم به صورت خود آموز C# رو یاد میگیرم برام کلی سوال پیش میاد که نمی دونم کجا بپرسم
لطفا یکی کمک کنه
Last edited by MERLIN_BOZORG; 23-08-2011 at 22:25.
اصولا #C به انجمن C مربوط نمیشه که تاپیک سوالاتش هم اینجا باشه
در انجمن دات نت مطرح کنین ...
سلام
اگه میشه کد حذف کردن یه فایل مثلا از درایو c رو برام بنویسید لطفا
تو نوشتنش مشکل دارم با c++
mer30
مثلا :
کد:برای مشاهده محتوا ، لطفا وارد شوید یا ثبت نام کنید
سلام،
من 2 تا سوال کلی داشتم :
1. COM چیست و چجوری میشه ازش تو برنامه نویسی استفاده کرد ؟
2. IPC را در برنامه نویسی کسی توضیح میده ؟
من زبانم داغونه خواهش مندم رفرنس انگلیسی ندید ، بی زحمت کامل توضیح دهید.
ممنون ببخشید وقت شما را گرفتم
سوال دوم :
من تفاوت و طرز استفاده __stdcall ، __cdecl، __fastcall، __thiscallرا بلد نیستم، در MSDN نگاه کردم ظاهرا کامل توضیح داده بود من کلمه کلمه ترجمه کردم ولی آخرش نفهمیدم چی شد، یعنی متوجه نشدم دقیقا وقتی از این ها استفاده می کنی چه اتفاقی می افته ؟ یا یکسری جاها گفته بود اگر در چنین وضعیتی باشید ف استفاده از این بهتره زیرا . . ..
من نه شرطش را متوجه شدم و نه دلیلش را.
من توضیحات انگلیسی MSDN را در اینجا ( با لینک کاملش ) قرار می دم ، هرکس که فهمید چی گفته لطفا توضیح بده ( بی زحمت توضیح کامل ) اگر لطف کنید ترجمه دقیق فارسی آن را بگذارید ، من کم کم یاد می گیرم متن انگلیسی بخوانم.
با تشکر از لطف دوستان-ببخشید اینقدر سوال می پرسما
__thiscall :
The __thiscall calling convention is used on member functions and is the default calling convention used by C++ member functions that do not use variable arguments. Under __thiscall, the callee cleans the stack, which is impossible for vararg functions. Arguments are pushed on the stack from right to left, with the this pointer being passed via register ECX, and not on the stack, on the x86 architecture.
One reason to use __thiscall is in classes whose member functions use __clrcall by default. In that case, you can use __thiscall to make individual member functions callable from native code.
When compiling with [ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ] , all functions and function pointers are __clrcall unless specified otherwise.
In releases before Visual C++ 2005, the thiscall calling convention could not be explicitly specified in a program, because thiscall was not a keyword.
vararg member functions use the __cdecl calling convention. All function arguments are pushed on the stack, with the this pointer placed on the stack last
Because this calling convention applies only to C++, there is no C name decoration scheme.
On Itanium Processor Family (IPF) and x64 machines, __thiscall is accepted and ignored by the compiler; on an IPF chip, by convention, parameters are passed in register.
For non-static class functions, if the function is defined out-of-line, the calling convention modifier does not have to be specified on the out-of-line definition. That is, for class non-static member methods, the calling convention specified during declaration is assumed at the point of definition.
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
__fastcall :
The __fastcall calling convention specifies that arguments to functions are to be passed in registers, when possible. The following list shows the implementation of this calling convention.
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
__cdecl :
This is the default calling convention for C and C++ programs. Because the stack is cleaned up by the caller, it can do vararg functions. The __cdecl calling convention creates larger executables than [ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ] , because it requires each function call to include stack cleanup code. The following list shows the implementation of this calling convention.
On Itanium Processor Family (IPF) and x64 processors, __cdecl is accepted and ignored by the compiler; on IPF, by convention, parameters are passed in register.
Place the __cdecl modifier before a variable or a function name. Because the C naming and calling conventions are the default, the only time you need to use __cdecl is when you have specified the /Gz (stdcall) or /Gr (fastcall) compiler option. The [ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ] compiler option forces the __cdecl calling convention.
For non-static class functions, if the function is defined out-of-line, the calling convention modifier does not have to be specified on the out-of-line definition. That is, for class non-static member methods, the calling convention specified during declaration is assumed at the point of definition. Given this class definition,
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
__stdcall:
The __stdcall calling convention is used to call Win32 API functions. The callee cleans the stack, so the compiler makes vararg functions __cdecl. Functions that use this calling convention require a function prototype.
The [ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ] compiler option specifies __stdcall for all functions not explicitly declared with a different calling convention.
Functions declared using the __stdcall modifier return values the same way as functions declared using [ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ] .
On Itanium Processor Family (IPF) and x64 processors, __stdcall is accepted and ignored by the compiler; on IPF, by convention, parameters are passed in register.
For non-static class functions, if the function is defined out-of-line, the calling convention modifier does not have to be specified on the out-of-line definition. That is, for class non-static member methods, the calling convention specified during declaration is assumed at the point of definition
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
هم اکنون 1 کاربر در حال مشاهده این تاپیک میباشد. (0 کاربر عضو شده و 1 مهمان)