সোমবার, ৯ অক্টোবর, ২০১৭

বাংলায় C ও C++ এর বেসিক ধারনা


1. C এর source  file কে .c  এবং C++ source  file কে .cpp দ্বারা সেভ করতে হয় ।

            ১) C এর ক্ষেত্রে ঃ sample.c 2) C++এর ক্ষেত্রে  ঃ sample.cpp
2.  C এর data type যথাক্রমে int,float,double,char,void ।   C++ এর data type যথাক্রমে int,float,double,char,void ,bool,wchar_t
int =একটি পূর্ণ সংখ্যা
float = ভগ্নাংশ বা দশমিক যুক্ত সংখ্যা । single precision float data type।
double = double precision float data type ।
char = একটি একক ক্যারেক্টার ।
bool =  এই ডাটা টাইপ ভারিয়েবেলের জন্য ০ বা ১ যেকোনো একটি মান নির্ধারণ করা যায় । logical expression এর ফলাফল রাখার জন্য এই ডাটা টাইপ ভারিয়েবেল ব্যবহার করা হয় । যদি expression এর মান সত্য বলে বিবেচিত হয় তবে ১ আর না হলে ০ দ্বারা নির্ধারিত হয় । 
3) C এর শুরুতে  ভারিয়েবেল declaration করতে হয় । না হলে প্রোগ্রাম error দেখায় । C++ এর যেকোনো জায়গায় ভারিয়েবেল declaration করা যায় 

4) C তে   "= " এর মাধ্যমে ভারিয়েবেলের মান নির্ধারিত হয় ।  C++ একই উপায়ে করা যায় । তবে নতুন হল
 data_type variable_name (value) 

5)প্রোগ্রামে যদি  একই নামে local ও  global ভারিয়েবেল থাকে তবে  C এবং  C++  উভয় local ভারিয়েবেল access করে । তবে  C++ এর সুবিধা হল ঃঃ এর মাধ্যমে global ভারিয়েবেল access যাবে ।

6) C এর key word
auto ,break,case,char,const,continue,default,do,double, else, enum, extern,
float, for, goto if,int long, register, return,short, signed, sizeof, static,
struct, switch, typedef ,union
unsigned ,void, volatile, while.
C++ এর key word
and,and_eq,asm,auto,bitand,bitor,bool,break,case,catch,char,class,compl,const,const_cast,continue
,default,delete,do,double,dynamic_cast,else,enum,explicit,export,extern,false,float,for,friend,goto,if,inline,int,long,mutable,namespace,new,not,not_eq,operator,or,or_eq,private,protected,public,register,reinterpret_cast,return,short,signed,sizeof,static,static_cast,struct,switch,template,this,throw,true,
try,typedef,typeid,typename,union,unsigned,using,virtual,void,volatile,wchar_t,while,xor,xor_e

 7)C তে constant variable ডিক্লিয়ার করা হয় ঃ
                                                 #define VOTING_AGE 23 , #define pi 3.1416

              C++ তে constant variable ডিক্লিয়ার করা হয় ঃ
                                       #define VOTING_AGE = 23 , #define pi =  3.1416
8)  Cও C++ এর ক্ষেত্রে একই ভাবে comment লেখা যায় । লেখার পদ্ধতি /*.........*/ । কিন্তু  C++  অন্যও ভাবে লেখা যায় । লেখার পদ্ধতি //......... ।

৯) C এর type casting
                     int x;
                     float y;
                     y = (float)x;
 C++ এর  type casting ও  C এর মত লেখা যায় । তবে ভিন্ন ভাবে ও লেখা যায় ঃ
                            int x;
                            float y;
                            y = float(x);
১০) C তে char type array এর মান নিচের মত করে নির্ধারণ করা যায়
                               char UserName[6]=''sabbir'';
    C++ তে char type array এর মান নিচের মত করে নির্ধারণ করা যায়
                             char UserName[]=''sabbir'';
 নিচের মত করেও নির্ধারণ করা যায়
                                         char UserName[7]={'s','a','b','b','i','r','/0'};

                                                                                                                                                                            চলবে..................

Share:

0 comments:

একটি মন্তব্য পোস্ট করুন