PascalÀ»
C++·Î º¯È¯Çϱâ

PascalÀ» C++·Î ¹Ù²Ù´Â Äü ·¹ÆÛ·±½º °¡À̵å

Quick Conversion Guide

Description

Pascal Syntax

C++ Syntax

Assignment Operator

:=

=

Boolean Relational Operators

 

 

"is equal to"

=

= =

"is not equal to"

<>

!=

"is more than"

>

>

"is less than"

<

<

"is more than or equal to"

>=

>=

"is less than or equal to"

<=

<=

Boolean Operators

 

 

AND

and

&&

OR

or

||

NOT

not

!

Array Declaration

 

 

One dimensional

identifier array [range] of type

type identifier [range]

Two dimensional

array [range] of type

type identifer [range][range]

Pointer Declaration

identifier :^type

type * identifier

Remainder

mod

%

Division

div

/

Record type

identifier = record ... end.

struct structName { ..... };

Function

function identifier (variable(s)): return type

returntype identifier(variable(s))

Procedure

procedure identifier(variable(s))

void identifier(variable(s))

Comment

{ .. }

// or /* ..*/


¹è°æ

ÀÌ ±ÛÀÇ ¸ñÀûÀº PascalÀ» C++·Î º¯È¯ÇÏ´Â °úÁ¤À» º¸´Ù ½±°Ô ÀÍÈ÷°íÀÚ ÇÏ´Â µ¥ ÀÖ´Ù. ÀÌ Á¡¿¡ À־ ÀÌ ±ÛÀº Pascal ¸í·É¾î¿Í C++ ¸í·É¾îÀÇ ´Ù¸¥ Á¡À» ¼³¸íÇØ ÁÙ °ÍÀÌ´Ù. 

ÇÁ·Î±×·¡¹Ö ¾ð¾î¸¦ ¹è¿ì´Â °¡Àå ÁÁÀº ¹æ¹ýÀº Á÷Á¢ »ç¿ëÇÏ´Â ¹æ¹ýÀÌ ÃÖ¼±ÀÌ´Ù. ÇÊÀÚ´Â ¿©·¯ºÐÀÌ Á÷Á¢ ¿¹Á¦¸¦ °¡Áö°í ½Ã°£À» µé¿© °øµéÀÌ´Â ¹æ¹ýÀÌ ÃÖ¼±À̶ó°í ±ÇÇÏ°í ½Í´Ù! ±×·¯ÇÑ ³ë·ÂÀÇ ½Ã°£µéÀº ÈξÀ ´õ °³³äÀ» º¸´Ù »¡¸® ÀÌÇØ½ÃŰ°í º¸´Ù ´É¼÷ÇÑ ÇÁ·Î±×·¡¸ÓÀÇ Áö¸§±æÀÌ µÉ °ÍÀ̱⠶§¹®ÀÌ´Ù. ¶ÇÇÑ ÈξÀ µð¹ö±×µµ ½¬¿ï °ÍÀÌ´Ù! Çà¿îÀ» ºó´Ù! 


ÁÖ ÇÁ·Î±×·¥

¸ðµç ÆÄ½ºÄ® ÇÁ·Î±×·¥Àº ´ÙÀ½°ú °°ÀÌ ½ÃÀÛÇÑ´Ù: 

    Program Donothing; 

    Begin 
    End. 

C++ÀÇ ÁÖ ÇÁ·Î±×·¥Àº ´ÙÀ½°ú °°Àº ¹æ½ÄÀÌ´Ù: 

    main() 

À§¿¡¼­ ¾Æ¹«¸® ¸¹Àº ´Ù¸¥ ÇÔ¼ö°¡ Á¸ÀçÇÒÁö¶óµµ ±×°Íµé Áß¿¡¼­ Çϳª´Â ¹Ýµå½Ã mainÀ̶õ À̸§À» °¡Áö°í ÀÖ¾î¾ß ÇÑ´Ù. ±×·¸Áö ¾ÊÀ¸¸é ÄÄÆÄÀÏ·¯´Â ¿¡·¯¸¦ ¹ß»ý½Ãų °ÍÀÌ´Ù. main ÇÔ¼ö´Â ÇÁ·Î±×·¥ÀÌ ½ÇÇàµÇ´Â ù ºÎºÐÀ» ¾Ë·Á ÁÖ´Â °÷ÀÌ´Ù. 


¶óÀ̺귯¸®¿Í À¯Àú Á¤ÀÇ À¯´Ö

ÆÄ½ºÄ®¿¡¼­, ¶óÀ̺귯¸®¿Í À¯´ÖÀ» Æ÷ÇÔ½ÃŰ´Â °ÍÀº "Uses" ¼½¼Ç¿¡¼­ ÇÑ´Ù. 

    Uses crt; 

    Uses myunit; {À¯Àú Á¤ÀÇ À¯´Ö} 

C++¿¡¼­´Â, #include ¸í·É¾î·Î ´ëÄ¡ÇÒ ¼ö ÀÖ´Ù. 

    #include &ltiostream.h> 

    #include "myunit.h" 

À¯Àú Á¤ÀÇ À¯´ÖÁÖÀ§¿¡ µû¿ÈÇ¥´Â Áß¿äÇÑ ¿ä¼ÒÀÌ´Ù. À̰ÍÀº ÄÄÆÄÀÏ·¯¿¡°Ô ÇöÀç µð·ºÅ丮¿¡¼­ ±× ÆÄÀÏÀ» ãÀ¸¶ó´Â ¸í·ÉÀ» ÁØ´Ù. 


ÄÚµåÀÇ ºí¶ô

ÆÄ½ºÄ®¿¡¼­: 

    Begin 
    End. 

C++: 



ÅØ½ºÆ® ÇÁ¸°Æ®Çϰí ÀÔ·Â ¹Þ±â

    ÇÁ¸°ÆÃ (Hello, world!)

    ÆÄ½ºÄ®¿¡¼­ "write" ¸í·É¾î´Â C++¿¡¼­´Â "cout"·Î ±³Ã¼µÉ ¼ö ÀÖ´Ù. 

      write ('ÁÁÀº ÇÏ·ç µÇ¼¼¿ä'); 

      writeln('From Ricky!'); 

      writeln; 

    C++¿¡¼­´Â 

      cout << "ÁÁÀº ÇÏ·ç µÇ¼¼¿ä"; 

      cout << "From Ricky!" << endl; 

      cout << endl; 

    "endl" Àº ¶óÀÎÀÇ ³¡À» ¸»ÇÑ´Ù. ¹°·Ð ¶óÀÎÀÇ ³¡À» ¾Ë·ÁÁÖ´Â "\n"À» »ç¿ëÇÒ ¼öµµ ÀÖ´Ù. 

    Input( UNIX)

    "Readln" Àº "cin"À¸·Î ¹Ù²ð ¼ö ÀÖ´Ù. 

      readln(x); 

    to 

      cin >> x; 

    ÀԷ¹ޱâ À§ÇØ >>(angle brackets)À» »ç¿ëÇÑ´Ù. 


º¯¼ö ¼±¾ð

ÆÄ½ºÄ®¿¡¼­, º¯¼öµÚ¿¡ ±× ŸÀÔ¸íÀ» ±â¼úÇÏ¸é µÈ´Ù. C++¿¡¼­´Â, ÆÄ½ºÄ®°ú ¹Ý´ëÀÇ ¹æ¹ýÀ» ¾²¸é µÈ´Ù. ¶Ç ÇϳªÀÇ Â÷ÀÌÁ¡Àº Áß°£¿¡ colonÀÌ ¾ø´Ù: 
 

Type

Pascal

C++

Integer

x: integer;

int x;

Character

ch: char;

char ch;

Real 

y: real;

float y;

Array

myarray[0..9] of int;

int myarray[10];

Strings

name: string(80);

char name[81];

newname: string;

char* newname;

Pointers

nodepointer = ^node;

node *x; or

x: nodepointer

node* x;

 

ÆÁ°ú °æ°í

  • Ç×»ó Æ÷ÀÎÅ͸¦ ÃʱâÈ­½ÃŲ´Ù. ¸¸¾à¿¡ ±×·¸Áö ¾ÊÀ¸¸é, NULL·Î ÃʱâÈ­µÈ´Ù´Â °ÍÀ» ¸í½ÉÇϱ⠹ٶõ´Ù. 
  • C++¿¡¼­ ¹è¿­ À妽º °ªÀº 0ÀÌ´Ù. ÆÄ½ºÄ®¿¡¼­´Â 1·Î ½ÃÀ۵ȴÙ. 
  • C++¿¡¼­´Â ¹®ÀÚ¿­ÀÇ ³¡¿¡ NULLÀ» Áý¾î³ÖÀ½À¸·Î½á ³¡À» ¾Ë ¼ö ÀÖ´Ù. 
  • "Var" ¼½¼ÇÀº ÆÄ½ºÄ®¿¡¼­¸¸ ³ªÅ¸³­´Ù. C++¿¡¼­´Â º¯¼ö´Â ¾îµð¼­µç Áö ¼±¾ð °¡´ÉÇÏ´Ù! 


ÇÁ·Î½ÃÀú¿Í ÇÔ¼ö

ÆÄ½ºÄ®ÀÇ ÇÁ·Î½ÃÀú´Â °ªÀ» ¹ÝȯÇÏÁö ¾Ê´Â´Ù. C++¿¡¼­´Â void ÇÔ¼ö·Î À̰Ͱú ¶È°°ÀÌ ±¸ÇöÇÒ ¼ö ÀÖ´Ù: 

     

    Procedure No_parameters;  
    Begin  

    End; 

    void No_parameters()  
     

     

ºñ·Ï ¾Æ¹«·± ÆÄ¶ó¹ÌÅͰ¡ ¾øÀ»Áö¶óµµ ()´Â ÇÔ¼ö¿¡¼­ ¸Å¿ì Áß¿äÇÏ´Ù. ±×·¸Áö ¾ÊÀ¸¸é C++ Àº ÇÔ¼ö ´ë½Å¿¡ º¯¼ö·Î °£ÁÖÇÒ °ÍÀÌ´Ù. 

Parameter Àü´ÞÇϱâ

ÆÄ¶ó¹ÌÅÍ´Â ÆÄ½ºÄ®¿¡¼­Ã³·³ Àü´ÞµÈ´Ù. 

     

    Procedure Hithere (x: integer);  
    Begin  

    End; 

    void Hithere (int x)  
     

     

ÂüÁ¶¿¡ ÀÇÇÑ Àü´Þ

¸¸¾à¿¡ ÆÄ½ºÄ®¿¡¼­ ÆÄ¶ó¹ÌÅÍÀÇ °ªÀ» º¯°æµÈ °ÍÀ» Àü´ÞÇϰíÀÚ ÇÒ ¶§ "var" ¶ó´Â Ű¿öµå¸¦ »ç¿ëÇÏ¿© Àü´ÞÇÑ´Ù. ±×·¯³ª C++¿¡¼­´Â, (&)±âÈ£¸¦ º¯¼ö¾Õ¿¡ »ç¿ëÇÏ¿© ¶È°°Àº ±â´ÉÀ» ¼öÇàÇÒ ¼ö ÀÖ´Ù: 
 

     

    Procedure Change (var x: integer);

    void Change(int &x);

     

°ªÀ» ¹ÝȯÇÏ´Â ÇÔ¼ö

´ëºÎºÐÀº ¹«¾ùÀΰ¡¸¦ ¹ÝȯÇÏ´Â ÇÔ¼ö¸¦ ÀÛ¼ºÇÏ°Ô µÈ´Ù. ÀÌ·± °æ¿ì¿¡ ´ÜÁö "void"´ë½Å ±×¿¡ ¸Â´Â ¹Ýȯ ŸÀÔÀ» Á¤ÀÇÇÏ¸é µÈ´Ù. 

     

    Function Foo : integer;

    int Foo();

    Function Bar (x: real) : char;

    char Bar (float x);

     

C++¿¡¼­´Â °ªÀ» ¹ÝȯÇÒ ¶§ "return"À» »ç¿ëÇÏ¸é µÈ´Ù. 
 

     

    Function Foo: integer; 

      int Foo()

    Begin 

      x: integer; 
      x: 
      Foo=x;

    End;

    int Foo() 

      { 

        int x; 

        x=5 

        return x; 
         

      }

     

ÇÔ¼ö ÇÁ·ÎÅäŸÀÔ

¸¸¾à¿¡ ¿øÇÑ´Ù¸é ÇÑ Àå¼Ò¿¡ ¸ðµç ÇÔ¼ö¸¦ ¼±¾ðÇÏ°í ±¸ÇöÇÒ ¼ö ÀÖ´Ù. ÇÏÁö¸¸ C++Àº °´Ã¼ ÁöÇâÇü ÇÁ·Î±×·¥À¸·Î ¼³°èµÇ¾ú´Ù. 

À̰ÍÀº ÇÔ¼ö ÇÁ·ÎÅäŸÀÔÀÇ ¿¹ÀÌ´Ù: 

    int Baz (char x, int y, float z); 

À̰ÍÀº ÇÔ¼ö°¡ ½ÇÁ¦ÀûÀ¸·Î ±¸ÇöµÇ´Â ºÎºÐÀÌ´Ù: 

    int Baz (char x, int y, float z) 

    . . . 


If, then, else

±¸¹®ÀÌ °£´ÜÇÏ´Ù¸é

     

    if x>y then write('¾È³ç');

    if (x>y) cout << "¾È³ç";

     

()ÀÌ ÀÖ´Â Áö "then"ÀÌ ÀÖ´Â Áö È®ÀÎÇÑ´Ù. 

¸¸¾à¿¡ ±¸¹®ÀÌ ÇÑ ¸í·É¾î ÀÌ»óÀ̶ó¸é

     

    if x>y then begin 

      write ('¾È³ç'); 
      writeln ('Ä£±¸!');

    end;

    if (x>y) { 

      cout << "¾È³ç"; 
      cout << "Ä£±¸!" << endl;

    }

     

°£´ÜÇÑ if, then, else ±¸¹®

     

    if a&ltb then wirte('¾È³ç') 

      else write ('Àß°¡');

    if (a&ltb) cout << "¾È³ç"; 

      else cout << "Àß°¡";

     

Çϳª ÀÌ»óÀÇ ¸í·É¾î¸¦ °¡Áø If, then, else ±¸¹®

     

    if a<=b then begin 

      write('¾È³ç'); 
      write (' Ä£±¸'); 

    end 
    else begin 

      write ('°¡ '); 
      write ('Áý¿¡!'); 

    end;

    if (a<=b) { 

      cout << "¾È³ç"; 
      cout << " Ä£±¸";

    } 
    else { 

      cout << "°¡ "; 
      cout << "Áý¿¡!";

    }

     

ÁßøµÈ if ±¸¹®

     

    if a>b then 
      if x&lty then write('Okay'); 

    else write ('A is less than b');

    if (a>b) { 
      if (x&lty) cout << "Okay"; 
    } 
    else cout << "A is less than b";

     


Assignment, equal, not equal, and, or, not

     

    ¿¬»ê 

    Pascal Way 

    C++ Way 

    ´ëÀÔ

    x:=y;

    x=y;

    µ¿µî¼º ºñ±³

    if x=y ...

    if (x==y) ...

    µ¿µîÇÏÁö ¾ÊÀ» ¶§

    if x<>y ...

    if (x!=y) ...

    AND

    if a>b and x>y ...

    if (a>b && x>y) ...

    OR

    if a>b or x>y

    if (a>b || x>y)...

    NOT

    if not a...

    if (!a) ...

     

°æ°í: À§ÀÇ ±âÈ£¸¦ ÁÖÀDZí°Ô º¸½Ê½Ã¿À. ¸¸¾à µ¿µî¼º ºñ±³¿¡¼­ =¸¸ »ç¿ëÇÏ¸é ¿¡·¯¸¦ ¹ÞÀ» °Í ÀÔ´Ï´Ù. Á¶½ÉÇϼ¼¿ä! 


Áõ°¡ ¿Í °¨¼Ò

Pascal ¿¡¼­ C++ ·ÎÀÇ º¯È¯: 

    inc(i); 
    dec(i); 

Àº 

    i++; 
    i--; 

++ ¿Í --µÚ¿¡ ¼¼¹ÌÄÝ·ÐÀº ÀØÁö ¸»ÀÚ. 


·çÇÁ(¼øÈ¯)

for ·çÇÁ

     

    Pascal 

    C++ 

    for i=0 to 9 do 
        write (i,' '); 
     

    for i=9 downto 0 do 
        writeln ('Hello, world!');

    for (i=0;i!=10;i++) 
      cout << i << " "; 
     

    for (i=9;i>=0; i--) 
      cout << "Hello, world!" << endl;

     

While ·çÇÁ

     

    Pascal 

    C++ 

    while a>b do  

      begin 

        ...

      end;

    while (a>b) 
    { 
       ... 
    } 

      or 

    do { 
       ... 
    } while (a>b)

     

À§¿¡¼­ C++ while{ }°ú { }whileÀÇ Â÷ÀÌÁ¡Àº { }whileÀº ÃÖ¼ÒÇÑ ÇÑ ¹øÀº ½ÇÇàÇÑ´Ù´Â °ÍÀÌ´Ù. 


Records ¿Í structures

     

    Pascal Record

    C++ Structure

    inven = record 
       product: string; 
       cost: real; 
       stock: integer; 
    end;

    struct inven { 
       char* product; 
       float cost; 
       int stock; 
    };

     

¼¼¹ÌÄÝ·ÐÀ» Âï´Â °Í¿¡ ´ëÇØ ÀØÁö ¸»ÀÚ. 


ÁÖ¼®

     

    Pascal ÁÖ¼® 

    C++  ÁÖ¼® 

    {À̰ÍÀº ÁÖ¼® ¿¹Á¦ÀÌ´Ù} 

    {À̰ÍÀº ÁÖ¼®ÀÌ µÎ ÁÙ ÀÌ»óÀÏ ¶§ »ç¿ëÇÑ ¿¹Á¦ÀÌ´Ù}

    //À̰ÍÀº ÁÖ¼®À» »ç¿ëÇÑ ¿¹Á¦ÀÌ´Ù 

    /*À̰͵µ ¸¶Âù°¡Áö·Î µÎ ¶óÀÎ ÀÌ»óÀÏ ¶§, »ç¿ëÇÑ ¿¹Á¦ÀÌ´Ù */

     

C++ ÄÄÆÄÀÏ·¯´Â //ÈÄÀÇ ¹®Àå¿¡ ´ëÇØ¼­´Â ¹«½ÃÇØ ¹ö¸°´Ù.(´Ü °°Àº ¶óÀο¡¼­¸¸) ±×¸®°í. ¿©·¯ ÁÙÀÎ °æ¿ì /* ¿Í */¸¦ »ç¿ëÇÑ´Ù. 


Case ¹®°ú switch ¹®

À̰ÍÀº ¿ì¸®¿¡°Ô »ó´çÇÑ ³ë·ÂÀ» °æ°¨½ÃÄÑ ÁØ´Ù. 

     

    Pascal case ¹®

    C++ switch¹®

    case i of 
    1: write ('¼ýÀÚ 1'); 
     

    2: write ('¼ýÀÚ 2'); 
     

    5: write ('¼ýÀÚ 5'); 
     

    else write ('¹üÀ§¸¦ ¹þ¾î³²'); 

    end;

      switch (i) { 
    case 1: 
       cout << "¼ýÀÚ 1"; 
       break; 
    case 2: 
       cout << "¼ýÀÚ 2"; 
       break; 
    case 5: 
       cout << "¼ýÀÚ 5"; 
       break; 
    default: 
       cout << "¹üÀ§¸¦ ¹þ¾î³²"; 
    }

     

C++ ±¸¹®¿¡¼­´Â °¢ case ¹®ÀÇ ³¡¿¡ break°¡ ÀÖÀ½À» ÁÖÁöÇϱ⠹ٶõ´Ù. ¸¸¾à¿¡ break°¡ ¾ø´Ù¸é ÇÁ·Î±×·¥Àº switch ±¸¹® ¹ÛÀ¸·Î ³ª¿ÀÁú ¸øÇÑ´Ù. °á±¹ ´Ù¸¥ °æ¿ìµµ ½ÇÇàÇÏ°Ô µÈ´Ù. 


»ó¼ö

C++¿¡¼­´Â »ó¼ö¸¦ ¼±¾ðÇÏ´Â ¹æ¹ýÀÌ µÎ °¡Áö°¡ ÀÖ´Ù. ù¹øÂ° ¹æ¹ýÀº Ű¿öµå "const."¸¦ »ç¿ëÇÏ´Â ¹æ¹ýÀÌ°í µÎ¹øÂ° ¹æ¹ýÀº #define ±¸¹®À» »ç¿ëÇÏ´Â ¹æ¹ýÀÌ´Ù. 

     

    Pascal »ó¼ö

    C++ »ó¼ö

    Const 
       X=10;

    const int X=10    ¶Ç´Â 
    #define X 10

     

º¯¼ö¿Í °°ÀÌ »ó¼ö ¼±¾ðÀº ÇÁ·Î±×·¥ÀÇ ÇÑ ¼½¼Ç¿¡¸¸ Á¦ÇѵÇÁö ¾Ê´Â´Ù. ÇÊ¿äÇÒ ¶§ Äڵ忡 ¾îµð´Â ³õ¿©Áú ¼ö ÀÖ´Ù. 


³ª¸ÓÁö

ÀÌ ¿ÀÆÛ·¹ÀÌÅÍ´Â ±×´ÙÁö ¸¹ÀÌ »ç¿ëµÇÁö´Â ¾Ê´Â´Ù. 

     

    Pascal 

    C++ 

    result:=x mod y;

    result=x % y;

     


Recursion

¼øÈ¯ È£Ãâ(C++ )Àº ÆÄ½ºÄ®°ú ¶È°°Àº ¹æ½ÄÀ¸·Î Á¦¾îµÈ´Ù. 

     

    Pascal 

    C++ 

    Function Fact(var x: integer): integer; 
      Begin 
         if x=0 then Fact=1; 
           else Fact=x*Fact(x-1); 
       End;

    int Fact(int &x) 
    { 
       if (x==0) return 1; 
       else return x*Fact(x-1); 
    }

     


Ä¿¸Çµå ¶óÀÎ ÀÎÀÚ

Ä¿¸Çµå ¶óÀÎ ÀÎÀÚ´Â main ÇÔ¼öÀÇ ¸Å°³º¯¼ö¸¦ ÅëÇØ Àü´ÞµÈ´Ù. Ä¿¸Çµå ¶óÀÎ ÀÎÀÚ¸¦ »ç¿ëÇÑ ÇÁ·Î±×·¥Àº ´ÙÀ½ÀÇ mainÀ» °¡Áú °ÍÀÌ´Ù. 

    main(int argc, char* argv[]); 

argc ´Â UNIX Ä¿¸Çµå ÇÁ·ÒÇÁÆ®¿¡¼­ ´Ù¸¥ ÀÎÀÚÀÇ ¼ö¸¦ ³ªÅ¸³½´Ù. argv´Â actual ¸Å°³º¯¼öÀÇ ¹è¿­À» À¯ÁöÇÑ´Ù. ¿¹¸¦ µé¸é: 

     

    Ä¿¸Çµå ÇÁ·ÒÇÁÆ®¿¡¼­ ´ÙÀ½°ú °°ÀÌ ÀÔ·ÂÇßÀ» °æ¿ì:

    ´ÙÀ½°ú °°ÀÌ ÀÎÀÚÀÇ °ªÀ» ¾ò´Â´Ù :

    genealogy

    argc=1 
    argv[0]="genealogy"

    genealogy in.txt

    argc=2 
    argv[0]="genealogy" 
    argv[1]="in.txt"

    genealogy in.txt out.txt 

    argc=3 
    argv[0]="genealogy" 
    argv[1]="in.txt" 
    argv[2]="out.txt"

    genealogy a b c d e

    argc=6 
    argv[0]="genealogy" 
    argv[1]="a" 
    argv[2]="b" 
    argv[3]="c" 
    argv[4]="d" 
    argv[5]="e"

     


¿­°ÅÇü ŸÀÔ

     

    Pascal 

    C++ 

    type fruit = (apple,orange,banana)

    enum fruit {apple,orange,banana}

     



 

µ¿Àû ÇÒ´ç 
À̰ÍÀº ¾ÆÁÖ ÁÁÀº ±â´ÉÀÌ´Ù. ÇÁ·Î±×·¥¿¡ Á¾Á¾ ÀÌ·± µ¿Àû ÇÒ´çÀ» »ç¿ëÇÒ ¼ö ÀÖ´Ù. 

     

    Pascal 

    C++ 

    nodepointer = ^node;

    x: nodepointer;

    node *x;

     

Allocating memory 

     

    new(x);

    x = new node;

     

Freeing memory 

     

    dispose(x); 

    delete x;

     


Classes¿Í structure¿¡¼­ µ¥ÀÌÅÍ ¾×¼¼½ºÇϱâ

¿ÀºêÁ÷Æ®¸¦ ÂüÁ¶ÇÏ´Â ¹æ½ÄÀº ÆÄ½ºÄ®¿¡¼­¿Í ´Ù¸¥ °Ô ¾ø´Ù. 

     

    Pascal 

    C++ 

    x: node;

    node x;

    x.id:=50;

    x.id=50;

    x.gpa:=3.43;

    x.gpa=3.43;

     

¸¸¾à¿¡ ¿ÀºêÁ÷Æ®°¡ Æ÷ÀÎÅÍ¿¡ ÀÇÇØ ÂüÁ¶µÈ´Ù¸é, Æ÷¸ËÀº Á¶±Ý ´Ù¸£´Ù. 

     

    Pascal 

    C++ 

    nodepointer = ^node

    x: nodepointer; 

    node *x;

    x^.id:=50;

    x->id=50;

    x^.gpa:=3.43;

    x->gpa=3.43;