Like Tree1Likes
  • 1 Post By laserlight

noobish some-questions (first day learning c++)

This is a discussion on noobish some-questions (first day learning c++) within the C++ Programming forums, part of the General Programming Boards category; 1: Code: cout << setiosflags(ios::fixed)<<1000000000000.0 << endl; if we skip setiosflags(ios::fixed) what will it happen 2: does Code: ValueSum += ...

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    65

    noobish some-questions (first day learning c++)

    1:
    Code:
    cout << setiosflags(ios::fixed)<<1000000000000.0 << endl;
    if we skip setiosflags(ios::fixed) what will it happen

    2: does
    Code:
    ValueSum += Value;
    means
    Code:
    ValueSum=ValueSum+Value
    3:[/code]void PrintChar(char c = '=', int n = 80)[/code]

    if we call the above function from main with these 4 options what will happen
    Code:
    PrintChar('*', 20); PrintChar('-'); PrintChar(); PrintChar(20);
    4: whats the different when we externally declare variables and how can we change them from different locations

    5: i cannot understand about the new option i think it somehow bind memory blocks? is it an array or something? when do we have to unbind it? if we dont what will it happen

    6: im unable to understand what substr is and how can we use it, also i cannot understand what getline() is

    thanks in advance

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,624
    Quote Originally Posted by cable
    if we skip setiosflags(ios::fixed) what will it happen
    Try it and find out for yourself

    Quote Originally Posted by cable
    2: does
    Code:
    ValueSum += Value;
    means
    Code:
    ValueSum=ValueSum+Value
    Once we add a semi-colon to the latter, yes, but note that due to operator overloading, what an operator normally means is not necessarily what it means.

    Quote Originally Posted by cable
    3:
    Code:
    void PrintChar(char c = '=', int n = 80)
    if we call the above function from main with these 4 options what will happen
    Try them and find out for yourself

    Quote Originally Posted by cable
    4: whats the different when we externally declare variables and how can we change them from different locations

    5: i cannot understand about the new option i think it somehow bind memory blocks? is it an array or something? when do we have to unbind it? if we dont what will it happen

    6: im unable to understand what substr is and how can we use it, also i cannot understand what getline() is
    What prompted you to ask all these questions at one go? Perhaps you should be working through some structured material, e.g., a book or a tutorial.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Nov 2010
    Posts
    65
    do you recommend me any good c++ tutorial?
    i have found one but it wasn't good enough

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,624
    I recommend the book Accelerated C++.
    Elysia likes this.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by cable View Post
    do you recommend me any good c++ tutorial?
    i have found one but it wasn't good enough
    This one seems okay:

    C++ Language Tutorial - C++ Documentation

    It's clear, up to date, well organized and covers a lot of material.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Noobish question
    By abachler in forum Windows Programming
    Replies: 0
    Last Post: 04-02-2008, 09:08 AM
  2. Replies: 35
    Last Post: 01-31-2008, 05:01 PM
  3. Learning C++ alone, A few questions
    By LegendsEnd in forum C++ Programming
    Replies: 6
    Last Post: 05-06-2007, 02:13 PM
  4. 2 Noobish Questions from a 2nd Day Learner
    By Bucket in forum C++ Programming
    Replies: 18
    Last Post: 08-25-2006, 01:20 PM
  5. Some questions about learning languages
    By Zewu in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 03-08-2003, 05:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21