Results 1 to 3 of 3
  1. #1
    sinusboi
    sinusboi is offline
    Guest
    Join Date
    2012 Sep
    Posts
    3
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Intro C++ For Newbie :)

    Speaking of C and C + + as the language of its predecessor, C is included language pemrograma n intermediate level.
    Creator of C is Brian W. Kernighan and Dennis M. Ritchie in 1972. C is a programming language structured program divides into a number of blocks(sub-program). The aim is to facilitate the making and program development. Programs written
    with C easily moved from one type of machine to another. it is due to the standardization of C is ANSI (American National Standards Institute) the reference compiler makers C.

    C + + was created a decade after C. C + + was created by Bjarne Stroustroup
    from Bell Laboratories, AT & T in 1983. Initially C + + named
    "A better C". Name of C + + itself named by Rick Mascitti. The sign + +
    derived from the increment operator in C language

    ,so for new lest try this u can do by part in part,and this is part one :

    A. Hello World
    Here is a sample C + + program that is simple
    # include <iostream>
    void main ()
    {
    cout << "Hello world. \ n";
    }
    Once compiled and dirun, the result is visible on the display Hello World.


    B. Function main ()
    Program C + + it will never be separated from the function / function. it is because it is a characteristic of OOP. A C + + program has at least one function the main (). This function is the beginning of the main program. Posts in main ()
    is the name of the function, whereas part enclosed by {and} are called block (body function). In this case, an early sign of a block {and} are marks the end of the block. As in Pascal, the Pascal {identical to BEGIN, whereas identical} END. The command void means that the function main () does not return a value / value. How to write a function main () is not absolute as above. Here's how another writing

    # include <iostream>
    int main ()
    {
    cout << "Hello world. \ n";
    return 0;
    }


    C. Statement
    Command cout << "Hello world. \ N"; is one example
    statement. Command is used to print the writing on the screen. Each statement must end with;
    It is important to note here that the C + + program is
    Case Sensitive, meaning uppercase and lowercase letters are considered different. Signs \ n is used to move the line.

    D. file Header
    In the example above, called iostream.h header file. The header file necessary for court orders can be executed. If the header file removed, there will be an error. To access the header file, use command # include <file header>, or # include "file header". In one program may involve more than one header file. Note:

    Command cout << "Hello world. \ N";
    can be replaced with printf ("Hello world. \ n");
    However, to be able to use printf required header file stdio.h
    E. Removing Screen
    In C + +, the command clrscr (); used to remove / clean up
    display. This command will be executed after adding the header file conio.h
    # include <iostream>
    # include <conio.h>
    void main ()
    {
    clrscr ();
    cout << "Hello world. \ n";
    }


    F. comment
    You can add comments to your program. Here's the style for
    add comments.
    / / ----------------------------------
    / / This is the first remarked
    / / ----------------------------------
    or
    / * ----------------------------------
    I remarked that this was the first
    ---------------------------------- * /

    this is part one i will upgarde part two in page 2 or 3 later

  2. #2
    sinusboi
    sinusboi is offline
    Guest
    Join Date
    2012 Sep
    Posts
    3
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0
    well like i said before i will cont this turor,and some trick for newbie,lest see my part 2 guys . . .

    STRINGS

    In programming, a string is a collection of some karakterkarakter. To distinguish the character string in C + + is distinguished writing. A value is a string enclosed in quotation marks if double "...", eg "I". While the character (char) flanked by signs single quotes, eg 's'.

    So what about the "s"?? In this case "s" is also a string, although the characters look just one constituent. But in fact, the "s" was drawn not only the character 's' only, but there are also NULL character or '\ 0', which serves as a sign of the end of the string.
    To declare a variable is a string, then the command: char variables [max character];

    example:
    char text [20];
    The above command means that the text is a string variable with the number of
    maximum characters that can be stored is 20 (including the character
    NULL).

    A. Initialization String
    Suppose a string variable say a sentence [30] will be rated "MY
    Learning C + + ", then the command:
    char sentence [30] = "MY LEARNING C + +";
    Program details as follows:
    # Include <iostream>
    # Include <conio.h>
    void main ()
    {
    int a;
    a = 20;
    char sentence [30] = "MY LEARNING C + +";
    cout << "value a =" << a << endl;
    cout << "Value sentence =" << sentence << endl;
    }

    It should not be like this!
    void main ()
    {
    int a;
    char sentence [30];
    a = 20;
    sentence = "I'M LEARNING C + +" / / or
    sentence [30] = "MY LEARNING C + +";
    cout << "value a =" << a << endl;
    cout << "Value sentence =" << sentence << endl;
    }

    C. Reading String from Keyboard
    Furthermore, how to read a string from the keyboard?
    Here's an example:
    # Include <iostream>
    # Include <conio.h>
    void main ()
    {
    char name [20];
    char address [30];
    cout << "Enter your name:";
    cin.getline (name, sizeof (name));
    cout << "Enter your address:";
    cin.getline (address, sizeof (address));
    cout << "Your Name:" << name << endl;
    cout << "Address is:" << address << endl;
    }

    D. Copying a String

    Then how to mengassign a string from a variable to a variable
    Another? For example, given a string kata1 "HALLO". Furthermore word2 will be given string
    of kata1. To do this, you can not give orders
    word2 = word1;
    The command used for the above purposes are to:
    strcpy (word2, word1) / / copy the contents of word1 to word2

    Example:
    # Include <iostream>
    # Include <conio.h>
    # Include <string.h>
    void main ()
    {
    kata1 char [20] = "HALLO";
    kata2 char [20];
    strcpy (word2, word1);
    cout << "word1:" << endl << word1;
    cout << ":" << endl << word2;
    }
    E. Function for String Operations
    Function-The following function can be used to manipulate strings.
    Before the function is used, add string.h header file to include.
    - Knowing the length of the string with strlen ()
    syntax:
    strlen (string)
    will mereturn integer specifies the length string.
    Example:
    int panjangteks;
    char sentence [30] = "C + + LEARNING IS NOT DIFFICULT";
    panjangteks = strlen (sentence);
    cout << "Length of string:" << panjangteks;
    - Combining strings with strcat ()
    Syntax:
    strcat (string1, string2)
    add string2 to string1.
    Example:
    kata1 char [5] = "ONE";
    kata2 char [5] = "TWO";
    strcat (word1, word2) / / value word1 be "ONE TWO"

    - Convert to uppercase with strupr ()
    Syntax:
    strupr (string)
    Changing small letters of the string to uppercase.
    Example;
    char string1 [30] = "aBcDefgHIJKLmno";
    strupr (string1) / / value of string1 to "ABCDEFGHIJKLMNO"
    - Convert to lowercase with strlwr ()
    Syntax:
    strlwr (string)
    Function is the opposite of strupr ().
    - Finding Substring with strstr ()
    Suppose given a string "New York City". Whether
    string "METRO" contained in that string?
    To determine this with C + +, we can use the function
    strstr ().
    Syntax:
    strstr (string1, string2);
    Function will be mereturn value of 1 if a substring of string2
    string1, and will mereturn 0 otherwise.
    Example:
    if (strstr ("New York City", "Cool") == 1)
    cout << "is a substring";
    else cout << "Not a substring";
    - Reverse a string with strrev ()
    How to reverse a string "C + +" to be acquired "C + +"?
    Here are the commands in C + +,
    syntax:
    strrev (string);

    Example:
    char word [10] = "C + +";
    strrev (word);
    cout << word;

  3. The Following User Says Thank You to sinusboi For This Useful Post:


  4. #3
    SAEBUR
    SAEBUR is offline
    New member
    Join Date
    2012 Aug
    Posts
    7
    Thanks
    0
    Thanked 3 Times in 2 Posts
    Rep Power
    0
    format your posts please!

Similar Threads

  1. [Help] Newbie
    By filipewyd in forum MineCraft Guides, Tutorials
    Replies: 1
    Last Post: 2012-11-11, 03:59 PM
  2. newbie say hallo
    By shadowalkers in forum Introduction / Say 'Hello'
    Replies: 0
    Last Post: 2011-10-28, 09:02 AM
  3. hi newbie here
    By seeksaak in forum Introduction / Say 'Hello'
    Replies: 1
    Last Post: 2011-08-29, 08:41 PM
  4. [C++] Intro to Game Dev Video Tutorial
    By Dwar in forum Programming Tutorials
    Replies: 0
    Last Post: 2010-11-29, 04:10 PM
  5. Hi!!! Im a newbie
    By reijin in forum Introduction / Say 'Hello'
    Replies: 3
    Last Post: 2010-11-29, 04:02 PM
Visitors found this page by searching for:
Nobody landed on this page from a search engine, yet!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •