Be a Supporter!

C++: Main

  • 25,293 Views
  • 144 Replies
New Topic Respond to this Topic
shazwoogle
shazwoogle
  • Member since: Sep. 27, 2004
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to C++: Main 2006-04-28 23:46:55 Reply

page 3 and now windows API that makes a sad shazwoogle

neowolf22964
neowolf22964
  • Member since: May. 1, 2004
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to C++: Main 2006-05-11 13:14:34 Reply

Sorry, this is just a post to get this topic up in the forums =P

Woot C++ main!

FlashStation
FlashStation
  • Member since: Feb. 26, 2005
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to C++: Main 2006-05-14 07:21:24 Reply

It seems to me that only a handful of users on NG only code with C++, come on guys, there has to be more.

FlashStation
FlashStation
  • Member since: Feb. 26, 2005
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to C++: Main 2006-05-14 07:53:30 Reply

I AM ELITE

Tell me what you thinkC++ : Constants

dELtaluca
dELtaluca
  • Member since: Apr. 16, 2004
  • Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to C++: Main 2006-05-18 12:30:49 Reply

I was going to do something like this when C++ main first started, but couldnt be arsed when i got half way through and computer restarted :P but ive done it now

C/C++ Linked List (theory)

http://newgrounds.co../topic.php?id=488121

i say theory, because it explains everything behind linked lists and doubly linked lists, and the sample i give, only deals with adding and removing items from start and end of linked list

with an extra example at end for random access in a singly linked list


using ShamelessPlug; NapePhysicsEngine.advertise();

BBS Signature
CaptinChu
CaptinChu
  • Member since: Sep. 11, 2005
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to C++: Main 2006-05-21 16:29:07 Reply

Captin chu's guide to basic C++! (Part I)

Naois
Naois
  • Member since: Oct. 31, 2005
  • Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to C++: Main 2006-05-22 20:35:13 Reply

I'd like to request a tutorial on Functions from one of the C++ masters here.

CaptinChu
CaptinChu
  • Member since: Sep. 11, 2005
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to C++: Main 2006-05-22 21:17:00 Reply

At 5/22/06 08:35 PM, Naois wrote: I'd like to request a tutorial on Functions from one of the C++ masters here.

C++: Basic Functions

Made upon your request.

Naois
Naois
  • Member since: Oct. 31, 2005
  • Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to C++: Main 2006-05-25 16:48:48 Reply

At 5/22/06 09:17 PM, CaptinChu wrote: C++: Basic Functions
Made upon your request.

Thanks!

Jcrypt
Jcrypt
  • Member since: Aug. 23, 2005
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to C++: Main 2006-05-25 21:02:48 Reply

What shoudl I write my next tutorial on?? Iv'e been wanting to write one for some time just don't know what

sheffgb
sheffgb
  • Member since: Jun. 14, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to C++: Main 2006-05-26 12:51:49 Reply

can i request a tutorial on classes/member functions?

i have never really used a class.

thanks!

Jcrypt
Jcrypt
  • Member since: Aug. 23, 2005
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to C++: Main 2006-05-26 13:57:43 Reply

At 5/26/06 12:51 PM, sheffgb wrote: can i request a tutorial on classes/member functions?

i have never really used a class.

thanks!

Yes, I got dibs on this one fellas :D i'll start it later today or early tomorrow morning!

Naois
Naois
  • Member since: Oct. 31, 2005
  • Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to C++: Main 2006-06-17 17:10:54 Reply

At 5/26/06 01:57 PM, Jcrypt wrote:
At 5/26/06 12:51 PM, sheffgb wrote: can i request a tutorial on classes/member functions?
Yes, I got dibs on this one fellas :D i'll start it later today or early tomorrow morning!

So... Are you going to actually do it? It's been almost a month...

iv00w
iv00w
  • Member since: Apr. 24, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to C++: Main 2006-06-18 12:14:05 Reply

omg i keep getting this problem, with every program:

when i insert for example this code:

#include <iostream>

int main()
{
std::cout << "Hello World!";
char response;
std::cin >>response;
return 0;
}

and then hit compile and run, the program wont run, and i get an error telling me that some file is not found.
Please help me, i get this with every program!

Jcrypt
Jcrypt
  • Member since: Aug. 23, 2005
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to C++: Main 2006-06-18 16:47:09 Reply

It sounds to me your header file 'iostream' is what it's saying is not found... if this is the case re-install your compiler seeing as the paths were messed up.

CaptinChu
CaptinChu
  • Member since: Sep. 11, 2005
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to C++: Main 2006-07-11 12:16:29 Reply

At 6/18/06 12:14 PM, iv00w wrote: omg i keep getting this problem, with every program:

when i insert for example this code:

#include <iostream>

int main()
{
std::cout << "Hello World!";
char response;
std::cin >>response;
return 0;
}

and then hit compile and run, the program wont run, and i get an error telling me that some file is not found.
Please help me, i get this with every program!

I'm sorry for the late response, but I see the problem. Are you used to typing in php code? If so, that might explain why the error existed.

You see, C++ is not a dynamic language. You must put ALL of your declared variables at the top of int main()

I hope that helps. If it doesn't, oh well...

BTW, I made a big, awesome tutorial on Structures and Classes. It doesn't quite go in-depth with classes yet, but I'm going to probably add that later in the topic.

Trapped-Light
Trapped-Light
  • Member since: May. 31, 2006
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to C++: Main 2006-08-01 21:58:15 Reply

At 6/18/06 12:14 PM, iv00w wrote: and then hit compile and run, the program wont run, and i get an error telling me that some file is not found.
Please help me, i get this with every program!

I tried it and it worked fine.

have I just bumped a really old thread? oh well
0x41
0x41
  • Member since: Dec. 30, 2004
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to C++: Main 2006-08-01 23:34:41 Reply

At 7/11/06 12:16 PM, CaptinChu wrote: You see, C++ is not a dynamic language. You must put ALL of your declared variables at the top of int main()

You're thinking of C. C++ allows for variable initialization any where.

#include <iostream>
using namespace std;

int function(int);

int main()
{
int a = 5;
cout<<a<<endl;
int b = 6;
cout<<b<<endl;
int c = 7;
c = function(c);
cout<<c;
return 0;
}

int function(int c)
{
return c+5;
}

thingie-348
thingie-348
  • Member since: Nov. 27, 2005
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to C++: Main 2006-08-12 15:00:45 Reply

helped

CaptinChu
CaptinChu
  • Member since: Sep. 11, 2005
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to C++: Main 2006-08-13 09:25:03 Reply

Captin Chu's Guide to basic C++ (part two)

I really hope the guides that I've been making were helpful.

thecoshman
thecoshman
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to C++: Main 2006-08-13 10:45:52 Reply

I am requesting a nice guide on how to use the swith function in c++, i think it is called a swicth. the command that lets you go,

if a =

1 > do this
2> do this

etc.

as you can, i have no idea how it works for c++

0x41
0x41
  • Member since: Dec. 30, 2004
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to C++: Main 2006-08-13 12:44:59 Reply

At 8/13/06 10:45 AM, thecoshman wrote: I am requesting a nice guide on how to use the swith function in c++, i think it is called a swicth. the command that lets you go,
if a =
1 > do this
2> do this
etc.
as you can, i have no idea how it works for c++

It's basically a cleaner way to write comparison statements. Don't know if it warrants it's own tutorial though.
---------------
int iValue = 0;
cin>>iValue;
switch(iValue){
case 1: cout<<"You entered 1\n";
break;
case 5: cout<<"You entered 5\n";
break;
default: cout<<"You entered something besides 1 or 5\n";
}
--------------- is equivalent to
int iValue = 0;
cin>>iValue;
if(iValue == 1) cout<<"You entered 1\n";
else if(iValue == 5) cout<<"You entered 5\n";
else cout<<"You entered something besides 1 or 5\n";
--------------is equivalent to
int iValue = 0;
cin>>iValue;
iValue == 1 ? cout<<"You entered 1\n" : iValue == 5 ? cout<<"You entered 5\n" : cout<<"You entered something besides 1 or 5\n";

phyconinja
phyconinja
  • Member since: Sep. 18, 2004
  • Offline.
Forum Stats
Member
Level 25
Blank Slate
Response to C++: Main 2006-08-18 21:28:01 Reply

At 8/13/06 12:44 PM, 0x41 wrote: stuff

can some one like make a tut.. and explaining this?
Im lost at the biggining..

CaptinChu
CaptinChu
  • Member since: Sep. 11, 2005
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to C++: Main 2006-08-18 21:34:04 Reply

At 8/18/06 09:28 PM, phyconinja wrote:
At 8/13/06 12:44 PM, 0x41 wrote: stuff
can some one like make a tut.. and explaining this?
Im lost at the biggining..

Some day, I'll make my third part to my guide of basic C++. In that, I'll explain if, else, switch, more on functions, and basic structures and classes.

For those few who were wondering, I will stop at the fourth and final part of basic C++, "The last of what I know." It will be on extended classes and everything I know about ios. If you could get through all four parts of my guides... yea, you'd pretty much know everything I do about C++. Pretty pathetic, really. : /

thoughtpolice
thoughtpolice
  • Member since: Mar. 24, 2003
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to C++: Main 2006-08-18 22:19:29 Reply

At 8/1/06 11:34 PM, 0x41 wrote: You're thinking of C. C++ allows for variable initialization any where.

[austin@continuum ~]$ cat c99.c
#include <stdio.h>

int whoom() {
return 5;
}

int main() {
int asdf = 5;
printf("%d\n",asdf);
char whoa[] = "datum";
printf("%s\n",whoa);
asdf = whoom();
printf("%d\n",asdf);
return 0;
}
[austin@continuum ~]$ gcc -std=c99 -Wall c99.c
[austin@continuum ~]$ ./a.out
5
datum
5
[austin@continuum ~]$


omg.
Playstation Network tag: muffin-noodle
the empty set

0x41
0x41
  • Member since: Dec. 30, 2004
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to C++: Main 2006-08-18 23:42:31 Reply

At 8/18/06 10:19 PM, KurtGodel wrote:

:code

hmmm, getting some conflicting information here :-O.

http://en.wikibooks...rogramming/Variables

"In C, all variable declarations (except for globals) must be done at the beginning of a block. You cannot declare your variables, insert some other statements, and then declare more variables. Variable declarations (if there are any) are always the first part of any block."
Are you compiling the C program with a C++ compiler? Maybe I'm (and the wiki editors) are getting C rules and C conventions confused with each other.

thoughtpolice
thoughtpolice
  • Member since: Mar. 24, 2003
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to C++: Main 2006-08-20 15:23:52 Reply

At 8/18/06 11:42 PM, 0x41 wrote: Are you compiling the C program with a C++ compiler? Maybe I'm (and the wiki editors) are getting C rules and C conventions confused with each other.

Well, IIRC the C99 standards say it is so (I'll take a look and get back to you later.) It is highly dependent on the compiler too, many compilers don't abide by the most recent standards. GCC does and there are some others, but don't expect the code I posted to compile on, say, Open Watcom.


omg.
Playstation Network tag: muffin-noodle
the empty set

Afro-Ninja
Afro-Ninja
  • Member since: Mar. 2, 2002
  • Offline.
Forum Stats
Moderator
Level 44
Game Developer
TenLetters
TenLetters
  • Member since: Sep. 15, 2005
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to C++: Main 2006-08-21 23:50:15 Reply

Oh Noes i missed this page. >:(

DFox
DFox
  • Member since: Aug. 9, 2003
  • Offline.
Forum Stats
Member
Level 30
Blank Slate
Response to C++: Main 2006-08-21 23:56:38 Reply

Nice update. Glad to see this is starting to move along!


BBS Signature