সি++

ডিপথট থেকে

টেমপ্লেট:Tocrসি++ একটি উচ্চ-স্তরের প্রোগ্রামিং ভাষা। ১৯৮০-র দশকের প্রথম দিকে বেল টেলিফোন ল্যাবরেটরিসের Bjarne Stroustrup গতানুগতিক সি ভাষার সাথে বস্তুনির্ভর প্রোগ্রামিং ও অন্য আরো কিছু সুবিধা যোগ করে এই ভাষাটি নির্মাণ করেন। বিশালকায় বাণিজ্যিক সফ্টওয়্যার তৈরির জন্য বর্তমানে সবচেয়ে জনপ্রিয় ভাষা জাভা এবং সি++। নিম্ন-স্তরের ভাষার খুব কাছাকাছি হওয়ার কারণে সি++ সবচেয়ে দ্রুতগামী ভাষাগুলোর একটি; এতে স্মৃতি বরাদ্দকরণ ও ব্যবস্থাপনার পূর্ণ নিয়ন্ত্রণ প্রোগ্রামারের হাতে থাকে। তবে এসব কারণে আবার সি++ শেখা সবচেয়ে কঠিন।

এই পাতায় সি++ এর একেবারে মৌলিক বিষয়গুলো উল্লেখ করা হয়েছে। প্রতিটি বিষয়ের উপর বিস্তারিত জানতে হলে বিশদ সূচিপত্রে উক্ত বিষয়ে ক্লিক করতে হবে। বিশদ সূচিপত্রের নিচ থেকে সি++ এর ভূমিকামূলক বিষয়গুলো নিচে নিচে সাজানো আছে। এই পাতার সূচিপত্র দেখা যাবে ডানের সাইডবারে।

বিশদ সূচিপত্র

সূচনা

প্রোগ্রামের কাঠামো

// my first program in C++

// Directives for the preprocessor, include the iostream standard file.
// This specific file (iostream) includes the declarations of the basic
// standard input-output library in C++
#include <iostream>

// All the elements of the standard C++ library are declared within
// what is called a namespace
using namespace std;

// The main function is the point by where all C++ programs start their execution;
// it is essential that all C++ programs have a main function.
// "int" is the type of the main function, every function has a type in c++
// Every function name is followed by "()". Body of a function is enclosed by "{}".
int main ()
{

// This line is a "c++ statement"; "cout" is the name of the standard output stream in C++
// "cout" is declared in the "iostream" standard file within the "std" namespace
// All statements must end with ";"
  cout << "Hello World!";

// Function must end with return, and optionally a return value;
// here the return value is "0"
// Return code of 0 in the main function means everything worked perfectly
  return 0;
}
// Another way to add comments is within "/*" and "*/"

চলক ও উপাত্ত ধরন

চলকের পরিচায়ক

Only letters, digits and single underscore characters are valid as identifiers of variables.

Must begin with a letter

Reserved identifiers that you must not use are:

asm, auto, bool, break, case, catch, char, class, 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, operator, 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

alternate representations of some of the identifiers are:

and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq

The C++ language is a case sensitive language.

ডেটার মৌলিক ধরনসমূহ

ধরন বর্ণনা আকার ব্যাপ্তী
char
short int(short)
int
long int (long)
bool
float
double
long double
wchar_t
type identifier = initial_value ;