My First C++ Program :)

Discussion in 'Programming General' started by WoW Sucks, Nov 19, 2007.

My First C++ Program :)
  1. Unread #1 - Nov 19, 2007 at 4:18 PM
  2. WoW Sucks
    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0

    WoW Sucks Global Moderator
    Banned

    My First C++ Program :)

    Well i made this with some help from SMR and Cruel.

    Code:
    #include <iostream> 
    #include <stdlib.h>
    #include <windows.h>
    
    using namespace std; 
    int minutes = 19;
    int sec = 60;
    void main()
    
    {
    
    SetConsoleTitle("WoW Sucks's Skull Timer");
    
    	while (minutes > -1)
    	{
    	system("cls");
    
    
    
    cout << ".oPYo. 8             8 8   ooooo  o" << endl;                      
    cout << "8      8             8 8     8" << endl;                           
    cout << "`Yooo. 8  .o  o    o 8 8     8    8 ooYoYo. .oPYo. oPYo." << endl; 
    cout << "    `8 8oP'   8    8 8 8     8    8 8  8  8 8oooo8 8  `'" << endl; 
    cout << "     8 8 `b.  8    8 8 8     8    8 8  8  8 8.     8 " << endl;    
    cout << "`YooP' 8  `o. `YooP' 8 8     8    8 8  8  8 `Yooo' 8 " << endl;   
    cout << ":.....:..::...:.....:....::::..:::....:..:..:.....:..::::" << "\n""\n""\t""\t""\t";
    
    
    
        	cout << minutes << " : " << sec << endl;
        	Sleep(1000);
        	sec--;
    	
        if(sec == 0)
    	{
            minutes--;
            sec = 60;
    	}
    	}
        
            	cout << "The Skull Should Have Gone" << endl;
    
    			
    		system("PAUSE");
    }
    
    Nothing good, but im only a beginner :)
     
  3. Unread #2 - Nov 19, 2007 at 6:31 PM
  4. Pimping_One
    Joined:
    Jul 17, 2007
    Posts:
    457
    Referrals:
    0
    Sythe Gold:
    0

    Pimping_One Forum Addict
    Banned

    My First C++ Program :)

    Congratz :D
     
  5. Unread #3 - Dec 1, 2007 at 11:49 AM
  6. iJamie
    Joined:
    Jul 22, 2007
    Posts:
    263
    Referrals:
    0
    Sythe Gold:
    0

    iJamie Forum Addict
    Banned

    My First C++ Program :)

    What it do ?
     
  7. Unread #4 - Dec 4, 2007 at 1:52 PM
  8. WoW Sucks
    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0

    WoW Sucks Global Moderator
    Banned

    My First C++ Program :)

    It counts down from 20 minutes, to show you when your skull will have gone =/
     
  9. Unread #5 - Dec 24, 2007 at 3:21 PM
  10. cookies
    Joined:
    Sep 18, 2007
    Posts:
    1,461
    Referrals:
    4
    Sythe Gold:
    0

    cookies Guru
    Banned

    My First C++ Program :)

    gratz although it is incready abilly simple. wait til you get to c++ crap :)
     
  11. Unread #6 - Dec 24, 2007 at 6:26 PM
  12. Faskist
    Joined:
    Apr 25, 2005
    Posts:
    1,869
    Referrals:
    0
    Sythe Gold:
    0

    Faskist Tuxhead
    Banned

    My First C++ Program :)

    Not sure why you'd use C++ for non-OO stuff, to be honest.

    EDIT: Might want to use Figlet for your ASCII-art.

    Code:
     ____   _            _  _   _____  _                        
    / ___| | | __ _   _ | || | |_   _|(_) _ __ ___    ___  _ __ 
    \___ \ | |/ /| | | || || |   | |  | || '_ ` _ \  / _ \| '__|
     ___) ||   < | |_| || || |   | |  | || | | | | ||  __/| |   
    |____/ |_|\_\ \__,_||_||_|   |_|  |_||_| |_| |_| \___||_|   
    Code:
          _/_/_/  _/                  _/  _/   
       _/        _/  _/    _/    _/  _/  _/    
        _/_/    _/_/      _/    _/  _/  _/     
           _/  _/  _/    _/    _/  _/  _/      
    _/_/_/    _/    _/    _/_/_/  _/  _/       
                                               
                                               
                                                        
    _/_/_/_/_/  _/                                      
       _/          _/_/_/  _/_/      _/_/    _/  _/_/   
      _/      _/  _/    _/    _/  _/_/_/_/  _/_/        
     _/      _/  _/    _/    _/  _/        _/           
    _/      _/  _/    _/    _/    _/_/_/  _/            
     
  13. Unread #7 - Jan 28, 2008 at 8:21 PM
  14. bubbagump
    Joined:
    Nov 21, 2007
    Posts:
    600
    Referrals:
    0
    Sythe Gold:
    0

    bubbagump Forum Addict

    My First C++ Program :)

    Nice job, Gratz
     
  15. Unread #8 - Jan 30, 2008 at 10:05 AM
  16. xx_mikey_xx
    Referrals:
    0

    xx_mikey_xx Guest

    My First C++ Program :)

    i wish i understood all of this... UGH i wana learn to program sooo bad lol :(
     
  17. Unread #9 - Feb 3, 2008 at 9:35 PM
  18. &#937; Omega &#937;
    Joined:
    Feb 3, 2008
    Posts:
    79
    Referrals:
    0
    Sythe Gold:
    0

    &#937; Omega &#937; Member

    My First C++ Program :)

    Pretty good man... I bet you'll get better in the future.​
     
  19. Unread #10 - Feb 5, 2008 at 6:54 PM
  20. Faskist
    Joined:
    Apr 25, 2005
    Posts:
    1,869
    Referrals:
    0
    Sythe Gold:
    0

    Faskist Tuxhead
    Banned

    My First C++ Program :)

    Can't you figure most of it out from first principles?
     
  21. Unread #11 - Feb 6, 2008 at 6:09 PM
  22. Olan14
    Joined:
    Jan 26, 2007
    Posts:
    581
    Referrals:
    0
    Sythe Gold:
    0

    Olan14 Forum Addict

    My First C++ Program :)

    Ugh, redundant include. Where do you reference anything in cstdlib? Also, yuck, win32 calls. If you're gonna write in C++ for win32, get out there anf just use .NET.
     
  23. Unread #12 - Feb 6, 2008 at 7:11 PM
  24. Line
    Joined:
    Jan 20, 2008
    Posts:
    271
    Referrals:
    1
    Sythe Gold:
    5

    Line Forum Addict

    My First C++ Program :)

    Nice, pretty cool, grats on 1st prog. =P
     
  25. Unread #13 - Feb 7, 2008 at 2:55 AM
  26. night
    Joined:
    Apr 21, 2005
    Posts:
    60
    Referrals:
    1
    Sythe Gold:
    5

    night Member
    Banned

    My First C++ Program :)

    you know, most people just use "hello world" as their first programs =p. Good job nonetheless...
     
  27. Unread #14 - Feb 10, 2008 at 11:46 PM
  28. poply
    Joined:
    Jul 11, 2005
    Posts:
    150
    Referrals:
    0
    Sythe Gold:
    0

    poply Active Member

    My First C++ Program :)

    Nice, im also trying to learn C++. ive known vb6 for years and i want to learn how to do some of the more complex things. I learned a few things from your source. thank you! i also tinkered with it and made it go backwards. it starts at 0 and ends after 20 minutes

    Code:
    #include <iostream> 
    #include <stdlib.h>
    #include <windows.h>
    
    using namespace std; 
    int minutes;
    int sec;
    void main()
    
    {
    
    SetConsoleTitle("WoW Sucks's Skull Timer");
    
    	while (minutes < 20)
    	{
    	system("cls");
    
    
    
    cout << ".oPYo. 8             8 8   ooooo  o" << endl;                      
    cout << "8      8             8 8     8" << endl;                           
    cout << "`Yooo. 8  .o  o    o 8 8     8    8 ooYoYo. .oPYo. oPYo." << endl; 
    cout << "    `8 8oP'   8    8 8 8     8    8 8  8  8 8oooo8 8  `'" << endl; 
    cout << "     8 8 `b.  8    8 8 8     8    8 8  8  8 8.     8 " << endl;    
    cout << "`YooP' 8  `o. `YooP' 8 8     8    8 8  8  8 `Yooo' 8 " << endl;   
    cout << ":.....:..::...:.....:....::::..:::....:..:..:.....:..::::" << "\n""\n""\t""\t""\t";
    
    
    
        	cout << minutes << " : " << sec++ << endl;;
    	Sleep(1000);
    
        if(sec == 60)
    	{
            minutes++;
            sec = 0;
    	}
    	}
        
            	cout << "The Skull Should Have Gone" << endl;
    
    			
    		system("PAUSE");
    }
     
  29. Unread #15 - Feb 11, 2008 at 8:16 PM
  30. Olan14
    Joined:
    Jan 26, 2007
    Posts:
    581
    Referrals:
    0
    Sythe Gold:
    0

    Olan14 Forum Addict

    My First C++ Program :)

    poply, that will probably not work, seeing as the variables used are initalized to garbage values initially, not 0 as expected.
     
  31. Unread #16 - Feb 12, 2008 at 8:44 AM
  32. poply
    Joined:
    Jul 11, 2005
    Posts:
    150
    Referrals:
    0
    Sythe Gold:
    0

    poply Active Member

    My First C++ Program :)

    Well it worked fine when i compiled it.
     
  33. Unread #17 - Feb 12, 2008 at 9:21 PM
  34. jman007_93
    Joined:
    Jan 7, 2008
    Posts:
    63
    Referrals:
    0
    Sythe Gold:
    0

    jman007_93 Member

    My First C++ Program :)

    compiled it and ran it. all it does for me is make the cmd window disappear then come back again, and repeat that many more times. i had to change void main() to int main() though. void wouldnt let me compile it.
     
  35. Unread #18 - Feb 13, 2008 at 9:49 AM
  36. Faskist
    Joined:
    Apr 25, 2005
    Posts:
    1,869
    Referrals:
    0
    Sythe Gold:
    0

    Faskist Tuxhead
    Banned

    My First C++ Program :)

    And it shouldn't. Main should be an int, because, even if you don't specify it, you are returning zero on successful execution.
     
  37. Unread #19 - Apr 3, 2008 at 7:04 PM
  38. yokken
    Joined:
    Apr 3, 2008
    Posts:
    6
    Referrals:
    0
    Sythe Gold:
    0

    yokken Newcomer

    My First C++ Program :)

    This was your FIRST C++ program? Mine went something along the lines of "How old are you? 17 \n You are 17 years old." Clearly you had help from someone. :)

    I don't see anything wrong with it. Whatever people are saying about non-OO programming, don't worry about it. Object-oriented stuff comes in later on. I know a fair bit of C++ (I'm not new to it, but I'm not quite intermediate [i don't know how to do pointers and i really don't care, but i consider that intermediate]) and I don't write OO code because I don't need it. Classes can go to hell.
     
  39. Unread #20 - Apr 3, 2008 at 9:22 PM
  40. Faskist
    Joined:
    Apr 25, 2005
    Posts:
    1,869
    Referrals:
    0
    Sythe Gold:
    0

    Faskist Tuxhead
    Banned

    My First C++ Program :)

    OO isn't useful unless you have a huge project, because the time spent designing classes etc. will outweigh the productivity gain.

    Also, what don't you understand about pointers?
     
< Download for Code::blocks IDE | [BeginnerTut] Making a timer countdown >

Users viewing this thread
1 guest


 
 
Adblock breaks this site