C++ help =[

Discussion in 'Programming General' started by manson_52, Nov 13, 2007.

C++ help =[
  1. Unread #1 - Nov 13, 2007 at 5:11 PM
  2. manson_52
    Joined:
    Aug 19, 2007
    Posts:
    18
    Referrals:
    0
    Sythe Gold:
    0

    manson_52 Newcomer

    C++ help =[

    A
    BB
    CCC
    DDDD
    EEEEE
    FFFFFF
    does anyone have in idea of how to do code like that in C++??
     
    Last edited: Jun 13, 2019
  3. Unread #2 - Nov 13, 2007 at 8:02 PM
  4. rogue poser
    Joined:
    Jul 10, 2005
    Posts:
    51
    Referrals:
    0
    Sythe Gold:
    0

    rogue poser Member

    C++ help =[

    wtf are u talking about....
     
  5. Unread #3 - Nov 14, 2007 at 3:51 PM
  6. manson_52
    Joined:
    Aug 19, 2007
    Posts:
    18
    Referrals:
    0
    Sythe Gold:
    0

    manson_52 Newcomer

    C++ help =[

    i meant a code that use 2 loops so it displays them, its for a test lol
     
  7. Unread #4 - Nov 14, 2007 at 4:36 PM
  8. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    C++ help =[

    char array[] = "ABCDE";
    for(int i = 0; i < 5; i++)
    {
    for(int i2 = 0; i2 < i; i2++)
    {
    cout << array << "\n";
    }
    }
     
  9. Unread #5 - Nov 20, 2007 at 6:16 PM
  10. Manson5's Class mate
    Referrals:
    0

    Manson5's Class mate Guest

    C++ help =[

    You Idiot, you should be asking these questions on dedicated c++ forums, not these stupid sties, and to SMR, why on earth did you just give him the answer? now he wont need to solve the excercise for himself, this was a class assignment, dropping hints or pointers to the right direction is one thing, but straight out giving the code to someone like "manson52" wont help them learn shit
     
  11. Unread #6 - Nov 20, 2007 at 6:59 PM
  12. manson_52
    Joined:
    Aug 19, 2007
    Posts:
    18
    Referrals:
    0
    Sythe Gold:
    0

    manson_52 Newcomer

    C++ help =[

    muted n00b
     
  13. Unread #7 - Nov 20, 2007 at 7:51 PM
  14. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    C++ help =[

    Yeah, but I am NOT a teacher. I don't care about how much someone actually 'learns'.

    On that note, I'm not being paid ridiculously low wages to argue with idiots. Your teacher on the other hand, is. Go complain to him that I helped your classmate.
     
  15. Unread #8 - Nov 22, 2007 at 8:13 PM
  16. Cruel__Machine
    Referrals:
    100

    Cruel__Machine Guest

    C++ help =[

    I don't think SMR's code works. The newline needs to be after the the nested loop. Otherwise there's a new line after every char. But tell me if I'm wrong, of course.
     
  17. Unread #9 - Nov 22, 2007 at 8:22 PM
  18. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    C++ help =[

    Ah yeah, I didn't spot that. Thanks.

    Just add "\n" between the ends of the two loops.
     
  19. Unread #10 - Nov 22, 2007 at 8:25 PM
  20. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    C++ help =[

    #include <iostream>
    using namespace std;

    int main(int argc, char* argv[])
    {
    char array[] = " ABCDE";
    for(int i = 0; i < 7; i++)
    {
    for(int i2 = 0; i2 < i; i2++)
    {
    cout << array;
    }
    cout << "\n";
    }
    return 0;
    }
    ^^ Use that instead, thanks Cruel for spotting the mistake.
     
  21. Unread #11 - Nov 23, 2007 at 7:30 AM
  22. Manson5's Class mate
    Referrals:
    0

    Manson5's Class mate Guest

    C++ help =[

    #include<iostream>
    #include<string>

    using namespace std;

    int main()
    {
    for(int x=0;x<=5;x++)
    {
    cout << string((x+1),65+x) << "\n";
    }

    cin.get();
    return 0;
    }

    There you go you fucking hopeless cockdrop's, go blow yourselfs over that
     
  23. Unread #12 - Nov 23, 2007 at 8:32 AM
  24. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    C++ help =[

    "i meant a code that use 2 loops so it displays them, its for a test lol"
     
  25. Unread #13 - Nov 23, 2007 at 11:28 PM
  26. Manson5's Class mate
    Referrals:
    0

    Manson5's Class mate Guest

    C++ help =[

    look closely at the code egghead -.-
     
  27. Unread #14 - Nov 23, 2007 at 11:34 PM
  28. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    C++ help =[

    The only loop there is the for()

    int main() is a function, not a loop, if that's what you're thinking. string() is not a loop, nor is cin.get(). A loop is for(), while() or do-while(). There is only one loop in your code.

    And for the record that will probably print out FFFFFF too.
    Change it to x<=5, not x<5.
     
  29. Unread #15 - Nov 23, 2007 at 11:47 PM
  30. O darn 0 Hp
    Referrals:
    0

    O darn 0 Hp Guest

    C++ help =[

    OOO i get it ty soooo much
     
  31. Unread #16 - Nov 24, 2007 at 7:24 AM
  32. Manson5's Class mate
    Referrals:
    0

    Manson5's Class mate Guest

    C++ help =[


    your not looking at it at all then, as for the "for the record" this tells me you truly do not know what the fuck you are talking about
     
  33. Unread #17 - Nov 24, 2007 at 3:00 PM
  34. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    C++ help =[

    Try running it yourself. I just did, and it prints out FFFFFF too. Please try and make sure that you are correct before you call people stupid for correcting you. I should add that I stated this wrong: x<=5, not x<5

    It should have been x<5; not x<=5. Why? Compare the results of your code:

    Code:
    #include<iostream>
    #include<string>
    
    using namespace std;
    
    int main()
    {
            for(int x=0;x<=5;x++)
            {
                    cout << string((x+1),65+x) << "\n";
            }
    
            cin.get();
            return 0;
    }
    Creates:
    With mine:
    Code:
    #include <iostream>
    using namespace std;
    
    int main(int argc, char* argv[])
    {
        char array[] = " ABCDE";
        for(int i = 0; i < 7; i++)
        {
            for(int i2 = 0; i2 < i; i2++)
            {
                cout << array[i];
            }
            cout << "\n";
        }
        return 0;
    }
    I truly pity your programming/IT teacher. Tell your headmaster to offer him a pay rise for what he has to put up with.

    And yes, there is only one loop in your code. I see one for, no while, and no do-while. Here: http://cplus.about.com/od/glossar1/g/loopdefinition.htm
     
  35. Unread #18 - Nov 25, 2007 at 2:44 PM
  36. manson_52
    Joined:
    Aug 19, 2007
    Posts:
    18
    Referrals:
    0
    Sythe Gold:
    0

    manson_52 Newcomer

    C++ help =[

    You all ready gave me that code last week class mate :p,

    oh and "FFFFFF" is supposed to be included lol, i didnt put it in the thing
     
  37. Unread #19 - Nov 25, 2007 at 2:57 PM
  38. Cruel__Machine
    Referrals:
    100

    Cruel__Machine Guest

    C++ help =[

    Haha. I like how that guy seems to think he's awesome... while he's taking some lame C starter course.
     
  39. Unread #20 - Nov 25, 2007 at 3:14 PM
  40. manson_52
    Joined:
    Aug 19, 2007
    Posts:
    18
    Referrals:
    0
    Sythe Gold:
    0

    manson_52 Newcomer

    C++ help =[

    what guy?
     
< Ive been working on a program that lowers your cpu usage with IE or Mozilla | [TUT4noobies] If Statement >

Users viewing this thread
1 guest


 
 
Adblock breaks this site