Description:
Best selling author Bruce Eckel has joined forces with Chuck Allison to write Thinking in C++, Volume 2, the sequel to the highly received and best selling Thinking in C++, Volume 1. Eckel is the master of teaching professional programmers how to quickly learn cutting edge topics in C++ that are glossed over in other C++ books. In Thinking in C++, Volume 2, the authors cover the finer points of exception handling, defensive programming and string and stream processing that every C++ programmer needs to know. Special attention is given to generic programming where the authors reveal little known techniques for effectively using the Standard Template Library. In addition, Eckel and Allison demonstrate how to apply RTTI, design patterns and concurrent programming techniques to improve the quality of industrial strength C++ applications. This book is targeted at programmers of all levels of experience who want to master C++.
برای برنامه نویسی ++C در لینوکس کافی است شما اطلاعاتی در مورد برنامه نویسی را داشته باشیدبرای نوشتن یک برنامه ++C ابتدا یک ادیتور مثل vim یا kate را باز کنید و یک برنامه خیلی ساده مثل برنامه خوش آمد گویی را تایپ کنید. مثال زیر یک برنامه بسیار ساده می باشد.
#include
int main()
{
cout << “welcome to c++n”;
returne 0;
}
سپس این برنامه را با یک نام دلخواه و با پسوند cpp ذخیره کرده و از محیط ادیتور خارج شوید.مرحله کد نویسی تمام شده حالا باید برنامه نوشته شده را کامپایل و اجرا کنید. برای این کار یک کنسول یا ترمینال باز کنید. برای کامپایل کردن برنامه از دستور ++g استفاده می کنیم.
root@amir# g++ -o t2 test1.cpp
دستور مقابل از چند ستون تشکیل شده است. ستون اول ++g مربوط به دستور کامپایل کردن می باشد. در ستون دوم سوئیچ o- برای ساختن فایل خروجی یا اجرایی بعد از کامپایل کردن مورد استفاده قرار گرفته است. در ستون سوم t2 اسم فایلی است که بعد از کامپایل کردن ایجاد می شود و یک فایل اجرایی می باشد. و در ستون اخر test1.cpp اسم فایلی است که شما برنامه ++C را در آن ذخیره کرده اید.
بعد از اجرای دستور بالا ابتدا برنامه شما کامپایل شده و سپس یک فایل با اسم t2 ساخته می شود.نکته: اگر برنامه شما خطا داشته باشد فایلی برای اجرا ساخته نمی شود و در مرحله کامپایل شماره خطهای دارای خطا را نمایش میدهد.اگر برنامه بدون خطا اجرا شود کامپایل به صورت زیر در کنسول اجرا شده و یک فایل ساخته می شود.
root@amir# g++ -o t2 test1.cpp
In file included from /usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/backward/iostream.h:31,
from test1.cpp:1:
/usr/lib/gcc/i386-redhatg-linux/3.4.2/../../../../include/c++/3.4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the
test1.cpp:6:2: warning: no newline at end of file
حالا می توانید فایل ساخته شده را اجرا کنید و نتیجه کار را ببینید.
root@amir# ./t2
welcome to c++