• Log in or sign up for an account here: https://www.sythe.org/login

C++ help =[

manson_52

Newcomer
Joined
Aug 19, 2007
Sythe Gold
0
Messages
18
A
BB
CCC
DDDD
EEEEE
FFFFFF
does anyone have in idea of how to do code like that in C++??
 
Last edited:
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
char array[] = "ABCDE";
for(int i = 0; i < 5; i++)
{
for(int i2 = 0; i2 < i; i2++)
{
cout << array << "\n";
}
}
 
A
BB
CCC
DDDD
EEEEE

does anyone have in idea of how to do code like that in C++??
email me:[email protected]

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
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
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
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.
 
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.
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
Ah yeah, I didn't spot that. Thanks.

Just add "\n" between the ends of the two loops.
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
#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.
 
#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
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
"i meant a code that use 2 loops so it displays them, its for a test lol"
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
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.
 
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.


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
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
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:
A
BB
CCC
DDDD
EEEEE
FFFFFF
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;
}
A
BB
CCC
DDDD
EEEEE
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
 
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
 
Haha. I like how that guy seems to think he's awesome... while he's taking some lame C starter course.
 
duelarena.gg
Back
Top