Bar Charts in C++? - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22

Thread: Bar Charts in C++?

  1. #16
    Join Date
    Oct 2009
    Posts
    38

    Re: Bar Charts in C++?

    okay well maybe the programming world is not for me then im just a student trying to pass the class that my teacher did not teach because i asked 5/25 students in the class and the teacher did not teach this material.

  2. #17
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,294

    Re: Bar Charts in C++?

    Your teacher taught you about arithmetic operations, for loops, reading from standard input and printing text to standard output (the console window, in this case), right? That is enough to solve this problem, assuming that you apply what was taught.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  3. #18
    Join Date
    Jan 2008
    Location
    California, USA
    Posts
    822

    Re: Bar Charts in C++?

    Would you prefer the solution on a silver plater like this
    Code:
    #include <iostream>
    #include <string>
    
    int main()
    {
        std::string ll1l;
        for(int ll(0), lll(4000),l1(0), ll1(5), l1l(100);
            ll++ != ll1 && (std::cout << "Sales amount: ", std::cin >>l1);
            std::cout << ll1l.append((l1 < 0 ||l1 > lll ?
            (std::cout << "Try again: ", std::cin >>l1, --ll) :l1)/ l1l, '*')
            << "\n" , ll1l.clear());
    }
    or the way these members had been trying to guide you in the right direction?
    It's your choice.

    And BTW, follow this example at your own risk
    Last edited by potatoCode; November 24th, 2009 at 05:56 AM. Reason: made some adjustment

  4. #19
    Join Date
    Jun 2009
    Location
    France
    Posts
    2,297

    Re: Bar Charts in C++?

    Quote Originally Posted by potatoCode View Post
    Would you prefer the solution on a silver plater like this
    Code:
    #include <iostream>
    #include <string>
    
    int main()
    {
        std::string ll1l;
        for(int ll(0), lll(4000),l1(0), ll1(5), l1l(100);
            ll++ != ll1 && (std::cout << "Sales amount: ", std::cin >>l1);
            std::cout << ll1l.append((l1 < 0 ||l1 > lll ?
            (std::cout << "Try again: ", std::cin >>l1, --ll) :l1)/ l1l, '*')
            << "\n" , ll1l.clear());
    }
    or the way these members had been trying to guide you in the right direction?
    It's your choice.

    And BTW, follow this example at your own risk
    Lol. Nice use of the comma operator. You don't see that one everyday.

  5. #20
    Join Date
    Nov 2006
    Location
    Essen, Germany
    Posts
    1,344

    Re: Bar Charts in C++?

    PotatoCode, you made my day! Looks like Paul McKenzie has been cloned.

  6. #21
    Join Date
    Apr 1999
    Posts
    27,431

    Re: Bar Charts in C++?

    Quote Originally Posted by potatoCode View Post
    Would you prefer the solution on a silver plater like this
    Code:
    #include <iostream>
    #include <string>
    
    int main()
    {
        std::string ll1l;
        for(int ll(0), lll(4000),l1(0), ll1(5), l1l(100);
            ll++ != ll1 && (std::cout << "Sales amount: ", std::cin >>l1);
            std::cout << ll1l.append((l1 < 0 ||l1 > lll ?
            (std::cout << "Try again: ", std::cin >>l1, --ll) :l1)/ l1l, '*')
            << "\n" , ll1l.clear());
    }
    or the way these members had been trying to guide you in the right direction?
    It's your choice.
    Yes, the old "give them the obfuscated answer version" trick. I've done that a few times ...

    Regards,

    Paul McKenzie

  7. #22
    Join Date
    Jan 2008
    Location
    California, USA
    Posts
    822

    Re: Bar Charts in C++?

    @monarch_dodra:
    Haha thanks. I hope I didn't break the forum rules by doing his homework

    @GNiewerth:
    Glad you had a good time reading it.
    And I had a feeling it was done before many times

    @Sabensohn70:
    I'm sorry for turning this into something that I thought funny.
    You can payback on my future post and I won't say a word.

    And I think it's good that you consider yourself a beginner.

    For the question you asked about using loop
    Conditional Statement

    A decent site that I think suitable for new learners like yourself.
    C++ Basic Tutorial

    A general reference site to get little deeper
    Reference site (www.cplusplus.com)

    And for the terms that are used in programming world that are not familiar to you
    C++ Glossary

    There are more,
    but these are good sites for the beginners to get start on their independant study

Page 2 of 2 FirstFirst 12

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center