சி++

கட்டற்ற கலைக்களஞ்சியமான விக்கிப்பீடியாவில் இருந்து.
தாவிச் செல்லவும்: வழிசெலுத்தல், தேடல்
C++
நிரல்மொழி வகை: multi-paradigm
தோன்றிய ஆண்டு: 1985
உருவாக்குநர்: பிஜார்னி ஸ்றோரப்
Typing discipline: Static, unsafe, nominative
முதன்மைப் பயனாக்கங்கள்: {{{நடைமுறைப்படுத்துவோர்கள்}}}
Dialects: ISO/IEC C++ 1998, ISO/IEC C++ 2003
பிறமொழித்தாக்கங்கள்: C, Simula, Ada 83, ALGOL 68, CLU, ML
இம்மொழியினால் ஏற்பட்ட தாக்கங்கள்: அடா 95, சி ஷாப், ஜாவா, பிஎச்பி, D, Aikido

சி++ சி அடுத்து வந்த ஓர் பொதுவான நிரலாக்கல் மொழியாகும். இது மேல் நிலை நிரலாக்கம் (High Level Programming) மற்றும் வன்பொருட்களை கையாளும் கீழ் நிலை நிரலாக்கம் ஆகிய இரண்டையும் ஆதரிப்பதால் இது ஓர் இடை நிலை மொழியாகும். இம்மொழியில் நிரலாக்க வரிகள் இவ்வாறுதான் வரவேண்டும் (அதாவது இந்தவரியில் இந்த நிரலாக்கம் தான் கோபால் நிரலாக்க மொழி போன்ற கட்டுப்பாடுகள் ஏதும் கிடையாது. பொதுவாக சி++ நிரல்கள் கம்பைல் செய்யப்படும். இவ்வாறு கம்பைல் பண்ணப்படும்போது அக்கணினியை இலக்கு வைத்த இயந்திரமொழிக்குக் கொண்டுவரப்படும். சி++ மொழி 1980 ஆம் ஆண்டு தொடக்கத்தில் ஏடீ & டீ பெல் ஆய்வுக் கூடத்தில் ஜோன் ஸ்ட்ரௌஸ்ட்ரப் என்பவரால் உருவாக்கப்பட்டது.


அமெரிக்க பெல் ஆய்வுகூடத்தில் பணியாற்றிய பிஜார்னி ஸ்டோரப் சி மொழியை மேம்படுத்தும் முகமாக 1979 ஆம் ஆண்டில் வகுப்புகளுடன் கூடிய சி (C with Classes) ஆக விருத்தி செய்தார். இது 1983 ஆம் ஆண்டில் சி மொழியில் வரும் ++ ஆனது increment operator ஐக் குறிக்கும் வகையில் இதுவும் சி++ என மாற்றப்பட்டது.

பொருளடக்கம்

[தொகு] மொழி அமைப்பு

[தொகு] தரவு இனங்கள்

  • void -
  • char - character
  • int - integer
  • float - floating point number
  • double - double precision float
  • bool - Boolean value, true or false
  • wchar_t - wide character

[தொகு] பெயர் வெளி

[தொகு] மாறிலிகள்

[தொகு] செயற்குறிகள்

[தொகு] அகிலத்துக்கு வணக்கம்

# include <iostream>
using namespace std;
 
int main ()
{
  cout << "Hello World!";
  return 0;
}
Hello World!


[தொகு] அடிப்படை உள்ளீடு வெளியீடு

[தொகு] வெளியீடு

  char *name="John";
  char *country="India";
 
  cout << "Hello, I am " << name << ". I am from "<< country << endl;

[தொகு] உள்ளீடு

# include <iostream>
using namespace std;
 
int main ()
{
  int i;
  cout << "Please enter an integer value: ";
  cin >> i;
  cout << "The value you entered is " << i;
  cout << " and its squre  is " << i*i << ".\n";
  return 0;
}
Please enter an integer value: 5
The value you entered is 5 and its square is 25.


[தொகு] கட்டுப்பாடு

[தொகு] எனில்/if else if

string selection;
selection = "ta";
 
if (selection=="hi")
  cout<< "You have selected the Hindi Wikipedia"; 
else if (selection=="ta")
  cout<< "You have selected the Tamil Wikipedia"; 
else
  cout<< "You have selected the English Wikipedia";
You have selected the Tamil Wikipedia


[தொகு] தெரிவு/switch

சி++ பி.எச்.பி போன்ற இதர மொழிகள் போல் அல்லாமல் சொற்தொடர்களை தெரிவில் பயன்படுத்த முடியாது.

int selection;
selection = 2;
switch (selection){
  case 1:
        cout<< "You have selected Tamil Wikipedia";
        break;
  case 2:
    cout<< "You have selected Hindi Wikipedia";
    break;
  default:
    cout<< "You have selected English Wikipedia";
    break;
    }
You have selected Hindi Wikipedia


[தொகு] சுற்று

[தொகு] while சுற்று

int i=1;
while(i<=5)
  {
  cout << "The number is "<< i <<"\n" ;
  i++;
  }
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5


[தொகு] do while சுற்று

int i=1;
do {
        cout << "The number is " << i << "\n";
        i++;
    } while (i <= 5);
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5


[தொகு] do while சுற்று

int i=1;
 
for (i=1; i<=5; i++)
{
  cout << "Iteration:"<<i<<" Hello World!\n";
}
Iteration:1 Hello World!
Iteration:2 Hello World!
Iteration:3 Hello World!
Iteration:4 Hello World!
Iteration:5 Hello World!


[தொகு] செயலி

[தொகு] pass by value

int main (){
  int add (int a, int b);
  int ans;
  ans = add(4, 2);
  cout << "Ths sum is " << ans << "\n";
  return 0;
  }
 
int add (int a, int b){
        int ans;
        ans = a + b;
        return ans;
        }
The Sum is 6


[தொகு] pass by references

int main (){
  void passbyref (int& a, int& b);
  int a=1, b=3;
  passbyref (a, b);
  cout << "a=" << a << ", b=" << b << "\n";
  return 0;
  }
 
void passbyref (int& a, int& b){
  a = a + 10;
  b= b + 10;
  }
a=11, b=13;


[தொகு] பொருள் நோக்கு நிரலாக்கம்

class Calculator {
    int x, y;
    public:
        void set_values (int,int);
        int add () {
                        int ans;
                        ans = x + y;
                        return ans;
                        }
        };
 
void Calculator::set_values (int a, int b) {
        x = a;
        y = b;
        }
 
int main () {
        Calculator c1;
        c1.set_values (5, 3);
        cout << "The sum is: " << c1.add() << endl;
        return 0;
        }
The sum is: 8


[தொகு] இவற்றையும் பாக்க

[தொகு] வெளி இணைப்புகள்

"http://ta.wikipedia.org/w/index.php?title=சி%2B%2B&oldid=1096081" இருந்து மீள்விக்கப்பட்டது
சொந்தப் பயன்பாட்டுக் கருவிகள்
பெயர்வெளிகள்

மாற்றுக்கள் மாற்றுருவங்கள்
செயல்கள்
வழிசெலுத்தல்
கருவிப் பெட்டி
மற்ற மொழிகளில்