Adblock breaks this site

My First C++ Program :)

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

  1. WoW Sucks

    WoW Sucks Global Moderator
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0
    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 :)
     
  2. Pimping_One

    Pimping_One Forum Addict
    Banned

    Joined:
    Jul 17, 2007
    Posts:
    457
    Referrals:
    0
    Sythe Gold:
    0
    My First C++ Program :)

    Congratz :D
     
  3. iJamie

    iJamie Forum Addict
    Banned

    Joined:
    Jul 22, 2007
    Posts:
    263
    Referrals:
    0
    Sythe Gold:
    0
    My First C++ Program :)

    What it do ?
     
  4. WoW Sucks

    WoW Sucks Global Moderator
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0
    My First C++ Program :)

    It counts down from 20 minutes, to show you when your skull will have gone =/
     
  5. cookies

    cookies Guru
    Banned

    Joined:
    Sep 18, 2007
    Posts:
    1,461
    Referrals:
    4
    Sythe Gold:
    0
    My First C++ Program :)

    gratz although it is incready abilly simple. wait til you get to c++ crap :)
     
  6. Faskist

    Faskist Tuxhead
    Banned

    Joined:
    Apr 25, 2005
    Posts:
    1,869
    Referrals:
    0
    Sythe Gold:
    0
    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:
          _/_/_/  _/                  _/  _/   
       _/        _/  _/    _/    _/  _/  _/    
        _/_/    _/_/      _/    _/  _/  _/     
           _/  _/  _/    _/    _/  _/  _/      
    _/_/_/    _/    _/    _/_/_/  _/  _/       
                                               
                                               
                                                        
    _/_/_/_/_/  _/                                      
       _/          _/_/_/  _/_/      _/_/    _/  _/_/   
      _/      _/  _/    _/    _/  _/_/_/_/  _/_/        
     _/      _/  _/    _/    _/  _/        _/           
    _/      _/  _/    _/    _/    _/_/_/  _/            
     
  7. bubbagump

    bubbagump Forum Addict

    Joined:
    Nov 21, 2007
    Posts:
    600
    Referrals:
    0
    Sythe Gold:
    0
    My First C++ Program :)

    Nice job, Gratz
     
  8. xx_mikey_xx

    xx_mikey_xx Guest

    Referrals:
    0
    My First C++ Program :)

    i wish i understood all of this... UGH i wana learn to program sooo bad lol :(
     
  9. &#937; Omega &#937;

    &#937; Omega &#937; Member

    Joined:
    Feb 3, 2008
    Posts:
    79
    Referrals:
    0
    Sythe Gold:
    0
    My First C++ Program :)

    Pretty good man... I bet you'll get better in the future.​
     
  10. Faskist

    Faskist Tuxhead
    Banned

    Joined:
    Apr 25, 2005
    Posts:
    1,869
    Referrals:
    0
    Sythe Gold:
    0
    My First C++ Program :)

    Can't you figure most of it out from first principles?
     
  11. Olan14

    Olan14 Forum Addict

    Joined:
    Jan 26, 2007
    Posts:
    581
    Referrals:
    0
    Sythe Gold:
    0
    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.
     
  12. Line

    Line Forum Addict

    Joined:
    Jan 20, 2008
    Posts:
    271
    Referrals:
    1
    Sythe Gold:
    5
    My First C++ Program :)

    Nice, pretty cool, grats on 1st prog. =P
     
  13. night

    night Member
    Banned

    Joined:
    Apr 21, 2005
    Posts:
    60
    Referrals:
    1
    Sythe Gold:
    5
    My First C++ Program :)

    you know, most people just use "hello world" as their first programs =p. Good job nonetheless...
     
  14. poply

    poply Active Member

    Joined:
    Jul 11, 2005
    Posts:
    150
    Referrals:
    0
    Sythe Gold:
    0
    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");
    }
     
  15. Olan14

    Olan14 Forum Addict

    Joined:
    Jan 26, 2007
    Posts:
    581
    Referrals:
    0
    Sythe Gold:
    0
    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.
     
  16. poply

    poply Active Member

    Joined:
    Jul 11, 2005
    Posts:
    150
    Referrals:
    0
    Sythe Gold:
    0
    My First C++ Program :)

    Well it worked fine when i compiled it.
     
  17. jman007_93

    jman007_93 Member

    Joined:
    Jan 7, 2008
    Posts:
    63
    Referrals:
    0
    Sythe Gold:
    0
    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.
     
  18. Faskist

    Faskist Tuxhead
    Banned

    Joined:
    Apr 25, 2005
    Posts:
    1,869
    Referrals:
    0
    Sythe Gold:
    0
    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.
     
  19. yokken

    yokken Newcomer

    Joined:
    Apr 3, 2008
    Posts:
    6
    Referrals:
    0
    Sythe Gold:
    0
    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.
     
  20. Faskist

    Faskist Tuxhead
    Banned

    Joined:
    Apr 25, 2005
    Posts:
    1,869
    Referrals:
    0
    Sythe Gold:
    0
    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 >


 
 
Adblock breaks this site