Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: new user of c++  (Read 3947 times)

0 Members and 1 Guest are viewing this topic.

taumang

    Topic Starter


    Greenhorn

    • Experience: Beginner
    • OS: Unknown
    new user of c++
    « on: February 18, 2011, 09:10:09 AM »
    hi,iam new user of c++ so i want tips of how to tackle c++ problems.please give me tips.

    Linux711



      Mentor

      Thanked: 59
      • Yes
      • Programming Blog
    • Certifications: List
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Re: new user of c++
    « Reply #1 on: February 18, 2011, 10:42:26 AM »
    You are very vague.

    Quote
    Listed below are some common programming errors
    1. Misuse of the Include Guard.
    A common mistake is to use same symbol in multiple files for #ifndef.
    2. Typo's : Using ">" for ">>" and "<" for "<<"
    3. Trying to directly access the private variables in the main program.
    4. Switch Statments without break.
    5. Wrong usage of postfix and prefix operator (diff between i++ and ++i)
    6. Undeclared and Unitialised Variables and functions.
    7. ALWAYS USE MAKE FILE if you have more than one C++ program. The order of
    compilations matters a lot too.
    8. Trying to include "INCORRECT" header fuction.
    9. Marking a member function as const in the class definition but not in the member function implementation.
    10. Returning a value in a void function.
    11. Confusing the name of an array with the contents of the first element.
    12. Cstring array Errors - Arr[10] = Arr[0] to Arr[9]. Trying to access Arr[10] element.
    13. Using "=" ( assignment operator ) instead of "= =" (comparison operators) scanf() without '&' and wrong format.(IN C)
    14. Trying to divide a number by Zero.
    15. Poor Loop Exiting comparisons will tend to either loop being not executed at all or goes to an infinite loop.
    16. Not using string functions and treating the strings are integer . Say trying to compare string by (string1= = string2) , rather than using strcmp command
    17. CString not terminated by '\0'- Null character
    18. Mismatched "{" or IF-ELSE statements or for that matter any looping statment.
    19.Namespace errors
    20. Forget }
    21. Wrong number of }
    22. Missing ;
    23. Missing )
    YouTube

    "Genius is persistence, not brain power." - Me

    "Insomnia is just a byproduct of, "It can't be done"" - LaVolpe

    taumang

      Topic Starter


      Greenhorn

      • Experience: Beginner
      • OS: Unknown
      Re: new user of c++
      « Reply #2 on: February 19, 2011, 01:05:19 AM »
      hi,iam new user of c++ so i want tips of how to tackle c++ problems.please give me tips.

      taumang

        Topic Starter


        Greenhorn

        • Experience: Beginner
        • OS: Unknown
        Re: new user of c++
        « Reply #3 on: February 19, 2011, 01:09:00 AM »
        please post me a program and its algorithm so that i can understand what you are talking about.

        Khasiar



          Intermediate

          Re: new user of c++
          « Reply #4 on: April 18, 2011, 12:07:25 AM »
          pretty basic stuff below, if you want to know more, ask what you want to know :p


          //double forward slash allows for comments

          #include <iostream> //#include will include header files that will allow for functions that are within, iostream will be almost always used

          using namespace std; //this will use standard namespace which will let you type cout instead of std::cout

          int main(){ //this will define main function, function works within parenthesis

          int number = 0; //sets variable number to 0 and declares i as an int

          for (int i = 0; i < 3; i++){//loop 3 times
          number++;//increment number by 1;
          }//end loop

          cout << number << endl; //output variable number (3) followed by a line break

          return 0; //returns zero
          }//end main

          Geek-9pm


            Mastermind
          • Geek After Dark
          • Thanked: 1026
            • Gekk9pm bnlog
          • Certifications: List
          • Computer: Specs
          • Experience: Expert
          • OS: Windows 10
          Re: new user of c++
          « Reply #5 on: April 18, 2011, 08:03:16 AM »
          Google:
          youtube C++ tutorial

          Here is 'Hello World'
          http://www.youtube.com/watch?v=vYHB0DUcfV0