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

My First C++ Program :)

Joined
Jan 21, 2007
Sythe Gold
0
Messages
3,708
Location
England
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 :)
 
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:
      _/_/_/  _/                  _/  _/   
   _/        _/  _/    _/    _/  _/  _/    
    _/_/    _/_/      _/    _/  _/  _/     
       _/  _/  _/    _/    _/  _/  _/      
_/_/_/    _/    _/    _/_/_/  _/  _/       
                                           
                                           
                                                    
_/_/_/_/_/  _/                                      
   _/          _/_/_/  _/_/      _/_/    _/  _/_/   
  _/      _/  _/    _/    _/  _/_/_/_/  _/_/        
 _/      _/  _/    _/    _/  _/        _/           
_/      _/  _/    _/    _/    _/_/_/  _/
 
i wish i understood all of this... UGH i wana learn to program sooo bad lol :(
 
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.
 
Nice, pretty cool, grats on 1st prog. =P
 
you know, most people just use "hello world" as their first programs =p. Good job nonetheless...
 
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");
}
 
poply, that will probably not work, seeing as the variables used are initalized to garbage values initially, not 0 as expected.
 
Well it worked fine when i compiled it.
 
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.
And it shouldn't. Main should be an int, because, even if you don't specify it, you are returning zero on successful execution.
 
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.
 
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.
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?
 
duelarena.gg
Back
Top