Thread: how do i duplicate this in c++

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    196

    how do i duplicate this in c++

    ive really been stuck

    http://img91.imageshack.us/img91/7803/letterssu2.gif

    and i dont know where to begin

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    I have absolutely no idea what you're asking...
    Sent from my iPadŽ

  3. #3
    Registered User
    Join Date
    Sep 2005
    Posts
    196
    how do i make the text go like that in c++

  4. #4
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    cout<<"a b a\n";

    If you mean to be able to change stuff on the screen without it scrolling and junk, checkout curses, thats some fun stuff.

  5. #5
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Seriously man, you couldn't possibly be less descriptive. It's literally impossible. I asked God. He agrees... it's impossible in this universe.

    I'm sure you can spend 30 seconds of your life writing something meaningful for us to work with.
    Sent from my iPadŽ

  6. #6
    Registered User
    Join Date
    Jan 2006
    Location
    Latvia
    Posts
    102
    I think he may want to, hmm, change those chars mechanically, like this:
    Code:
    #include <iostream>
    using namespace std;
    int main()
    {
        
    char letter=66;
    
        for(;;)
        {
        letter--;
        cout<<letter;
        letter++;
        cout<<letter;
        letter--;
        cout<<letter;
        letter++;
        cout<<endl;
        }
        cin.get();
    }

  7. #7
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    That code will never run
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  8. #8
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Code:
    #include <iostream>
    #include <string>
    
    using namespace std;
    
    // This is a horozontal version of what I think 
    // (note we cannot help much if you're always 
    // this illucid), you want. edit for vertical.
    
    int main ( void )
    {
    	string	A  = "AAAAAAAAA\n",
    		B  = "BBBBBBBBB\n";
    	char	ID = 'A';
    
    	while ( true )
    	{
    		cin.get();
    
    		if ( ID == 'A' ) cout<< A;
    		else cout<< B;
    
    		ID == 'A' ? ID = 'B': ID = 'A';
    	}
    
    	return 0;
    }
    Last edited by twomers; 08-15-2006 at 04:46 AM.

  9. #9
    Registered User
    Join Date
    Jan 2006
    Location
    Latvia
    Posts
    102
    Quote Originally Posted by Mario F.
    That code will never run
    Why? Do you see mistakes? It runs on my Dev-Cpp 4.9.9.2 as I expected.

  10. #10
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    If I see mistakes?

    Did you actually ran your code, or are you being smart?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  11. #11
    Registered User
    Join Date
    Jan 2006
    Location
    Latvia
    Posts
    102
    The code compiles and runs, I know I'm not smart, so please correct me. Are you about that infinite for(; loop? Try to compile and run it, I really want to know what's wrong there, because I won't find out myself. Also, it's not actually all code, i'd never use that loop in my programs without break; in it.

  12. #12
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    You were asked repeteadly to be more precise in what is that you want to do. You ignored these requests. Do you expect me to be more precise by explaining to you what do I mean by will not run?

    I don't need to compile and run it to know it will not do what is expected. You entered an infinit loop. Your processor will jump to 100% usage and the only way to stop it is to abort the program execution. cin.get() will never run.

    If you compiled and executed your own program you certainly saw this. So why ask me what is wrong. It's right there under your nose.

    And... lilhahawk, do us all a big favor and do please explain once and for all what is that you want to do.
    Last edited by Mario F.; 08-15-2006 at 06:37 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  13. #13
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Yup, there's nothing wrong with the code. It's just a meaningless program programmed in a bit silly way. I believe this would be an easier way to print "ABA" endlessly
    Code:
    while (1)
        std::cout << "ABA\n";
    Edit: Mario, you are not replaying to the OP. Since he doesn't elaborate onhis wishes we're just proposing meaningless solutions.
    Last edited by anon; 08-15-2006 at 06:36 AM.

  14. #14
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Quote Originally Posted by Mario F.
    And... do us all a big favor and either stop posting in your own thread or do please explain once and for all what is that you want to do.
    You should probably take a look at the name of the OP and the name of who you've been replying to this whole time. Also, saying something won't run when it does and meaning it won't run properly are two different things.
    Sent from my iPadŽ

  15. #15
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by SlyMaelstrom
    Also, saying something won't run when it does and meaning it won't run properly are two different things.
    I didn't even realize I said so until now. Should have added "as expected".

    EDIT: I confused you with Lilhawk overload. For that I'm sorry. Still... your code is no good. Do please read the tutorials on this website about for loops. They are only very rarely used as you did.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. excel (detecting duplicate data)
    By xddxogm3 in forum Tech Board
    Replies: 6
    Last Post: 01-11-2007, 10:21 PM
  2. Eliminating duplicate values from a 20x2 array
    By desipunjabi in forum C Programming
    Replies: 2
    Last Post: 10-29-2005, 09:11 PM
  3. How to duplicate a tree?
    By franziss in forum C Programming
    Replies: 2
    Last Post: 01-16-2005, 12:23 AM
  4. duplicate detection algorithm
    By Gustaff in forum C Programming
    Replies: 4
    Last Post: 01-28-2003, 12:26 PM
  5. How to check duplicate line in text file?
    By ooosawaddee3 in forum C++ Programming
    Replies: 3
    Last Post: 10-30-2002, 06:35 PM