Adblock breaks this site

C++ help =[

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

  1. manson_52

    manson_52 Newcomer

    Joined:
    Aug 19, 2007
    Posts:
    18
    Referrals:
    0
    Sythe Gold:
    0
    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
  2. rogue poser

    rogue poser Member

    Joined:
    Jul 10, 2005
    Posts:
    51
    Referrals:
    0
    Sythe Gold:
    0
    C++ help =[

    wtf are u talking about....
     
  3. manson_52

    manson_52 Newcomer

    Joined:
    Aug 19, 2007
    Posts:
    18
    Referrals:
    0
    Sythe Gold:
    0
    C++ help =[

    i meant a code that use 2 loops so it displays them, its for a test lol
     
  4. Govind

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    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
    C++ help =[

    char array[] = "ABCDE";
    for(int i = 0; i < 5; i++)
    {
    for(int i2 = 0; i2 < i; i2++)
    {
    cout << array << "\n";
    }
    }
     
  5. Manson5's Class mate

    Manson5's Class mate Guest

    Referrals:
    0
    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
     
  6. manson_52

    manson_52 Newcomer

    Joined:
    Aug 19, 2007
    Posts:
    18
    Referrals:
    0
    Sythe Gold:
    0
    C++ help =[

    muted n00b
     
  7. Govind

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    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
    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.
     
  8. Cruel__Machine

    Cruel__Machine Guest

    Referrals:
    100
    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.
     
  9. Govind

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    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
    C++ help =[

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

    Just add "\n" between the ends of the two loops.
     
  10. Govind

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    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
    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.
     
  11. Manson5's Class mate

    Manson5's Class mate Guest

    Referrals:
    0
    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
     
  12. Govind

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    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
    C++ help =[

    "i meant a code that use 2 loops so it displays them, its for a test lol"
     
  13. Manson5's Class mate

    Manson5's Class mate Guest

    Referrals:
    0
    C++ help =[

    look closely at the code egghead -.-
     
  14. Govind

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    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
    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.
     
  15. O darn 0 Hp

    O darn 0 Hp Guest

    Referrals:
    0
    C++ help =[

    OOO i get it ty soooo much
     
  16. Manson5's Class mate

    Manson5's Class mate Guest

    Referrals:
    0
    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
     
  17. Govind

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    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
    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
     
  18. manson_52

    manson_52 Newcomer

    Joined:
    Aug 19, 2007
    Posts:
    18
    Referrals:
    0
    Sythe Gold:
    0
    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
     
  19. Cruel__Machine

    Cruel__Machine Guest

    Referrals:
    100
    C++ help =[

    Haha. I like how that guy seems to think he's awesome... while he's taking some lame C starter course.
     
  20. manson_52

    manson_52 Newcomer

    Joined:
    Aug 19, 2007
    Posts:
    18
    Referrals:
    0
    Sythe Gold:
    0
    C++ help =[

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


 
 
Adblock breaks this site