motherboards
+ Reply to Thread
Results 1 to 9 of 9

Thread: Tutorial #1: C++ Basics

  1. #1
    Regular Member

    Status
    Shell_Shock is offline

    Last Online
    19-04-2014 @ 20:03
    Join Date
    Aug 2013
    Location
    Waterford, PA
    Posts
    184
    CPU: AMD A8-4555M APU
    M/B: HP-193B
    RAM: 6GB DDR3
    GPU: AMD Radeon HD 7600G
    • Shell_Shock's Full Spec's
      • Cooling:
      • Rear Intake, Side Exhaust fans
      • Sound:
      • Altec Lansing Speakers; IDT Advanced Audio Codec
      • Monitor:
      • 15" 1080p LCD Laptop Screen
      • OS:
      • Crunchbang Linux
    Thanks
    1
    Thanked 20 Times in 14 Posts
    Points: 1,397, Level: 10
    Points: 1,397, Level: 10
    Level completed: 24%,
    Points required for next Level: 153
    Level completed: 24%, Points required for next Level: 153
    Overall activity: 51.0%
    Overall activity: 51.0%

    Cool Tutorial #1: C++ Basics

    Hello Everybody,
    Today i'm going to be teaching you guys the basics of C++, mostly just the standard outputs and inputs, but first we'll NEed a compiler. A Compiler is a program that takes the code you've written, and turns it into Machine Code, which the computer understands and allows it to perform actions. I prefer to use an IDE, an IDE is and Integrated Development Environment. They offer Syntax Highlighting, Tab Completion and many other features, and they aljmsot always come with a built in Compiler. First off We'll need to pick an IDE/Compiler, for Windows my Personal Favorite was Code::Blocks, but if you're using Windows 7 you can still use Dev-C++(It has a lot of errors in Windows 8). Once These are installed we can start coding! Now, we'll need to understand C++ first. C++ is an Object Oriented Programming Language, and is based off of Standard C, IT is used widely in the world today and can accomplish anything, in order to program in C++ we'll need to understand it's basics. First off We'll always start the program with certain preprocessor directives, these are things that tell the compiler to include into the execution of the program, to make things easier and faster. The first line of the code is commonly: #include <iostream> The "#include" tells the program to include a certain element, and "<iostream>" is the standard library for C++ programs, which allows basic input/output. Nex we'll add the body of the Program, so to speak, this is the line int main() . This statement allows the program to function, and everything outside of it arre commands in the "main" part of the program. After "int main()" YOu can either add a space or go to a new lin. (C++ is not space sensitive, but it helps keep things organized) The next thing you need is a set of curly brackets, like these: {}. Everything inside of these brackets is the included main, and the first things to be ran in the program. Without them, nothing can be done inside the brackets goes everything to be ran, and immediately after the brackets goes using namespace std. This statement tells us that we are using the standard namesapce and everything included in it. Since we are only doing output and input, we'll need to learn cout and cin, Cout is used when displaying text or numbers, and looks like this: cout << "blabaaasdf" whie cin is used for entering text or numers and looks like this: cin >> lol. Now for something drastically important. for almost every statement in C++, you need to insert a semicolon, or a ;. Without this, C++ doesn't know where the statement stops. The only exceptins are if and else statements amoung other complex things we won't worry about today, so for now the only thing that needs a semicolon is everything after "using namespace std", and including that as well. So for todays program we want to know and display a name. We'l need string statements for this. A String is a combination of letters of symbols, and is used for data. We'll need to include the <string.h>> preprocessor directive for this program. NOw a program will exit without doing anything if you don't include cin.ignore()and cin.get() at the end, so that the user has to press enter. Also, we want it to return with no erros right? so we need to include the phrase return 0; and the end, right before the Curly bracket. Now that Ive explained the things we'll be using in this program, lets see what it looks like!

    Code:
    #include <iostream>
    #include <string>
    int main () {
        using namespace std;
        string name;
        cout << "Enter your name.\n\n";
            cin >> name;
                cout << "Your name is: " << name;
    cin.ignore();
    cin.get();
        return 0;
    }
    The \n\n in the code means that it wants to make 2 new lines, and in order to use the strings, we have to define them. For isntance if i was using numbers instead of string name; it would be int x; and I'd have it define the integer x. Please feel free to ask questions below, i didn't cover everything on account of its 11PM and i have to get up at 5AM. The output of the code looks like this:

    Program: Enter your name.
    You: Alex
    Program: Yur name is: Alex

    In order to do this, enter the code i displayed earlier int oyour IDE, and then compile it. IF you do not know how to compile it, read the FAQ or help documentation as each program has different method for compiling. Mess around with it, add mor to it, but most importantly, Have Fun!
    Programmer, Ethical Hacker, Tech Support, Geek Extraordinaire.

  2. The following users thank 5 For this above post:

    Alpha (19-12-2013), calemus (20-12-2013), markaflias (20-12-2013), whenyournex2me (23-03-2014), xelosia (25-12-2013)

  3. #2
    Member

    Status
    Alpha is offline

    Last Online
    05-04-2014 @ 08:04
    Join Date
    Jun 2013
    Location
    Hemet CA
    Posts
    72
    CPU:
    M/B:
    RAM:
    GPU:
    • Alpha's Full Spec's
      • Case:
      • Thermaltake Chaser A1 Mid Tower Case
      • Monitor:
      • Gateway 1080p HD Display
      • OS:
      • Linux Ubuntu/Windows 8
    Thanks
    43
    Thanked 9 Times in 8 Posts
    Points: 924, Level: 7
    Points: 924, Level: 7
    Level completed: 87%,
    Points required for next Level: 26
    Level completed: 87%, Points required for next Level: 26
    Overall activity: 9.0%
    Overall activity: 9.0%

    Default Re: Tutorial #1: C++ Basics

    Thanks so much, looking forward to more tutorials soon!

  4. #3
    Regular Member

    Status
    Pete is offline

    Last Online
    16-04-2014 @ 08:25
    Join Date
    May 2013
    Location
    Denmark
    Posts
    350
    CPU: Intel i5 4670K @ 4.4GHz
    M/B: Asus Z87-PRO
    RAM: 2x8Gb Kingston HyperX Beast 2133MHz
    GPU: Gigabyte Nvidia GTX780 @ 1223MHz
    • Pete's Full Spec's
      • Case:
      • Fractal design Arc midi R2
      • PSU:
      • XFX ProSeries Black Edition 850W
      • Cooling:
      • Alphacool VPP655 pump 2x Alphacool UT60 240 rads EK Supremacy Plexi cpu-block EK-FC Titan SE + backplate gpu-block 4x NB-eLoop 1900rpm fans
      • Monitor:
      • BenQ GL2460 24&quot; LED
      • OS:
      • Win 8 Pro N
    Thanks
    9
    Thanked 18 Times in 18 Posts
    Points: 6,513, Level: 23
    Points: 6,513, Level: 23
    Level completed: 93%,
    Points required for next Level: 37
    Level completed: 93%, Points required for next Level: 37
    Overall activity: 23.0%
    Overall activity: 23.0%

    Default Re: Tutorial #1: C++ Basics

    for not making the first tutorial the "hello world" program

  5. #4
    Regular Member

    Status
    Shell_Shock is offline

    Last Online
    19-04-2014 @ 20:03
    Join Date
    Aug 2013
    Location
    Waterford, PA
    Posts
    184
    CPU: AMD A8-4555M APU
    M/B: HP-193B
    RAM: 6GB DDR3
    GPU: AMD Radeon HD 7600G
    • Shell_Shock's Full Spec's
      • Cooling:
      • Rear Intake, Side Exhaust fans
      • Sound:
      • Altec Lansing Speakers; IDT Advanced Audio Codec
      • Monitor:
      • 15&quot; 1080p LCD Laptop Screen
      • OS:
      • Crunchbang Linux
    Thanks
    1
    Thanked 20 Times in 14 Posts
    Points: 1,397, Level: 10
    Points: 1,397, Level: 10
    Level completed: 24%,
    Points required for next Level: 153
    Level completed: 24%, Points required for next Level: 153
    Overall activity: 51.0%
    Overall activity: 51.0%

    Default Re: Tutorial #1: C++ Basics

    In my opinioin Hello World is a meak example, it only shows the output, this example covers strings, input and output, as long as return statements and ways to get the windows to stay open until the user wants it to close.
    Programmer, Ethical Hacker, Tech Support, Geek Extraordinaire.

  6. #5
    New Member

    Status
    markaflias is offline

    Last Online
    14-01-2014 @ 13:26
    Join Date
    Dec 2013
    Location
    Alicante
    Posts
    5
    CPU: i7 2700K
    M/B: Asrock Z77 Extreme 6
    RAM: Kingston hyper x @ 1600MHz CL9
    GPU: Sapphire 7950 vapor x @ 1175/1575
    • markaflias's Full Spec's
      • Case:
      • Thermaltake Element S with 25cm side fan mod
      • PSU:
      • Corsair HX850
      • Cooling:
      • Thermaltake Extreme 3.0
      • Sound:
      • Asus Xonar dg
      • Monitor:
      • Acer 222SLQ
      • OS:
      • Windows 7 64 bits Sp1
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Points: 189, Level: 2
    Points: 189, Level: 2
    Level completed: 39%,
    Points required for next Level: 61
    Level completed: 39%, Points required for next Level: 61
    Overall activity: 0%
    Overall activity: 0%

    Default Re: Tutorial #1: C++ Basics

    Very nice We appreciate your work :P

  7. #6
    Regular Member

    Status
    Shell_Shock is offline

    Last Online
    19-04-2014 @ 20:03
    Join Date
    Aug 2013
    Location
    Waterford, PA
    Posts
    184
    CPU: AMD A8-4555M APU
    M/B: HP-193B
    RAM: 6GB DDR3
    GPU: AMD Radeon HD 7600G
    • Shell_Shock's Full Spec's
      • Cooling:
      • Rear Intake, Side Exhaust fans
      • Sound:
      • Altec Lansing Speakers; IDT Advanced Audio Codec
      • Monitor:
      • 15&quot; 1080p LCD Laptop Screen
      • OS:
      • Crunchbang Linux
    Thanks
    1
    Thanked 20 Times in 14 Posts
    Points: 1,397, Level: 10
    Points: 1,397, Level: 10
    Level completed: 24%,
    Points required for next Level: 153
    Level completed: 24%, Points required for next Level: 153
    Overall activity: 51.0%
    Overall activity: 51.0%

    Default Re: Tutorial #1: C++ Basics

    Anytime
    Programmer, Ethical Hacker, Tech Support, Geek Extraordinaire.

  8. #7
    Regular Member

    Status
    Smiki007 is offline

    Last Online
    18-04-2014 @ 23:38
    Join Date
    Apr 2011
    Location
    Lima, Peru
    Posts
    780
    CPU: i7 3970x @ 5.0GHz
    M/B: Rampage IV Black Edition
    RAM: Corsair Dominator Platinum DDR3 1600 MHz, 64GB
    GPU: 2x EVGA GTX 780 SLI with EK Water Blocks
    • Smiki007's Full Spec's
      • Case:
      • Obsidian 900d
      • PSU:
      • Enermax MaxRevo 1350W 80+ Gold
      • Cooling:
      • Swiftech APOGEE HD Ultimate Extreme Performance Water Block (Black)+ Swiftech MCP 655B Pump + Swiftech MCRES Rev.2 Reservoir + Phobya G-Changer 240mm &amp; 360mm Radiators
      • Monitor:
      • ASUS VG278H (27&quot;, 3D, 120Hz, 2ms 1920x1080)
      • OS:
      • W7 Professional x64 SP1
    Thanks
    61
    Thanked 83 Times in 71 Posts
    Points: 7,194, Level: 25
    Points: 7,194, Level: 25
    Level completed: 29%,
    Points required for next Level: 356
    Level completed: 29%, Points required for next Level: 356
    Overall activity: 99.3%
    Overall activity: 99.3%

    Default Re: Tutorial #1: C++ Basics

    Good first lesson Tutorial.

    Always look beyond the limits...

  9. #8
    Regular Member

    Status
    Shell_Shock is offline

    Last Online
    19-04-2014 @ 20:03
    Join Date
    Aug 2013
    Location
    Waterford, PA
    Posts
    184
    CPU: AMD A8-4555M APU
    M/B: HP-193B
    RAM: 6GB DDR3
    GPU: AMD Radeon HD 7600G
    • Shell_Shock's Full Spec's
      • Cooling:
      • Rear Intake, Side Exhaust fans
      • Sound:
      • Altec Lansing Speakers; IDT Advanced Audio Codec
      • Monitor:
      • 15&quot; 1080p LCD Laptop Screen
      • OS:
      • Crunchbang Linux
    Thanks
    1
    Thanked 20 Times in 14 Posts
    Points: 1,397, Level: 10
    Points: 1,397, Level: 10
    Level completed: 24%,
    Points required for next Level: 153
    Level completed: 24%, Points required for next Level: 153
    Overall activity: 51.0%
    Overall activity: 51.0%

    Default Re: Tutorial #1: C++ Basics

    Thanks, I figured i'd get the basaics down, and eventually go more complex.
    Programmer, Ethical Hacker, Tech Support, Geek Extraordinaire.

  10. #9
    Member

    Status
    dacul is offline

    Last Online
    13-02-2014 @ 13:12
    Join Date
    Aug 2012
    Location
    Romania
    Posts
    62
    CPU: AMD A10- 5800K
    M/B: ASRock FM2A85X Extreme 6
    RAM: Hyper X 8 GB 1600
    GPU: Radeon HD 7660D
    • dacul's Full Spec's
      • Case:
      • Chaser A31
      • PSU:
      • Lepa G750
      • Sound:
      • N/A
      • Monitor:
      • LG Flatron L1717S
      • OS:
      • 7
    Thanks
    0
    Thanked 7 Times in 7 Posts
    Points: 1,437, Level: 10
    Points: 1,437, Level: 10
    Level completed: 44%,
    Points required for next Level: 113
    Level completed: 44%, Points required for next Level: 113
    Overall activity: 5.0%
    Overall activity: 5.0%

    Default Re: Tutorial #1: C++ Basics

    I'm into phyton and java now. Thx for this. Looking forward to see more coming.

+ Reply to Thread

Ads

Posting Permissions

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

Similar Threads

  1. First Weekly Tutorial
    By Shell_Shock in forum Programming
    Replies: 7
    Last Post: 19-12-2013, 19:44
  2. Replies: 0
    Last Post: 14-02-2012, 11:30
  3. overclock basics
    By russell16688 in forum Memory Overclocking
    Replies: 3
    Last Post: 06-05-2007, 19:48

Search tags for this page

basics for c+

,

tutorial for altec speaker for laptop

Click on a term to search for related topics.

Tags for this Thread