Lesson About c/c++

Discussion in 'C and C++' started by troy357, Jun 24, 2016.

  1. Hello Class
    start na tayo. but be warned. i am not always present... but i'll be watching your attendance very stickly...
    just a brief background or orientation.
    c ang main focus ko... ako mismo lito pa sa c++.
    now to program in c. u can use turbo c or borland c++ builder (BCB) or msvc or any c/c++ compiler. but here i will use BCB or Turbo C.
    sa BCB try version 6. o yun bagong Borland Development Suit ( BDS ).
    pero para wag ng malito lalo na sa begginner. try to find the same one i used.
    try kong maging graphical sa lesson... so that means it will be harder for me to make. but please bare the time delay.
    [​IMG]
    now kung meron kayo nyan. alright then.
    1. c/c++ Lesson 1 - console
    a. creating a project in console.
    to create run BCB. on File Select NEW->Other->Console Wizard
    sa Console Wizard. there are options. normally default will be ok. but in case na iba. choose c. uncheck "specify project source". chk multi-thread and console app.
    ito most likely ang makikita nyo..
    //---------------------------------------------------------------------------
    #pragma hdrstop
    //---------------------------------------------------------------------------
    #pragma argsused
    int main(int argc, char* argv[])
    {
    return 0;
    }
    yun #pragma - we can all ignore. i myself dont know it. honestly.
    now observe the c structure.
    int main() - this is the main routine... me parameter sya na int argc, char* argv[]. ang purpose nito if u r a jurasic user like me. is for ex. copy gsmsandwich.txt
    so it means that gsmsandwich.txt will be use inside the main routine later on.
    it's an input to be exact.
    now me scope ang c. normally begin with { and end with }
    sa gitna doon ang programming. but if we use add func/routine. sa labas ng main().
    return 0; it's 0 bec. we have int main().
    ito ang data type sa bcb
    32-bit data types, sizes, and ranges
    Type Size (bits) Range Sample applications
    unsigned char 8 0 <= X <= 255 Small numbers and full PC character set
    char 8 -128 <= X <= 127 Very small numbers and ASCII characters
    short int 16 -32,768 <= X <= 32,767 Counting, small numbers, loop control
    unsigned int 32 0 <= X <= 4,294,967,295 Large numbers and loops
    int 32 -2,147,483,648 <= X <= 2,147,483,647 Counting, small numbers, loop control
    unsigned long 32 0 <= X <= 4,294,967,295 Astronomical distances
    enum 32 -2,147,483,648 <= X <= 2,147,483,647 Ordered sets of values
    long 32 -2,147,483,648 <= X <= 2,147,483,647 Large numbers, populations
    float 32 1.18 10^-38 < |X| < 3.40 10^38 Scientific (7-digit) precision)
    double 64 2.23 10^-308 < |X| < 1.79 10^308 Scientific (15-digit precision)
    long double 80 3.37 10^-4932 < |X| < 1.18 10^4932 Financial (18-digit precision)
    ito simple sample project i did..

     

Share This Page