Advertisement

Lets make a c++ program!

Started by January 29, 2011 12:27 AM
62 comments, last by sprite_hound 13 years, 9 months ago

'SteveDeFacto' said:

I'll start:#include <windows.h>


This does not compile on any machine I own on any standard C++ compiler. Are you sure it's correct, standard C++?


I have to assume that you are either joking or that you are a noob. What OS are you using and does your compiler have the proper include directories defined?

'Bregma' said:

'SteveDeFacto' said:

I'll start:#include <windows.h>


This does not compile on any machine I own on any standard C++ compiler. Are you sure it's correct, standard C++?


I have to assume that you are either joking or that you are a noob. What OS are you using and does your compiler have the proper include directories defined?


He knows full-well what windows.h is for. He's making the point that C++ isn't used only for Windows development, and that windows.h and WinMain aren't standard C++ so they really shouldn't be used in an exercise like this.
Mike Popoloski | Journal | SlimDX
Advertisement

He knows full-well what windows.h is for. He's making the point that C++ isn't used only for Windows development, and that windows.h and WinMain aren't standard C++ so they really shouldn't be used in an exercise like this.


Agreed. Also should be a little bit moderated.

Engineering Manager at Deloitte Australia

This isn't working. I think it'd be more interesting to post an actual program and then propose changes to optimize it.

Optimize this:



template <class T>
inline void erase_list_item(std::list<T>& erase_list, std::list<T>& the_list)
{
std::list<T>::iterator i1;
i1 = erase_list.begin();
while (erase_list.end()!=i1)
{
if (the_list.size())
{
std::list<T>::iterator i2;
i2 = erase_list.begin();
while (the_list.end()!=i2)
{
T o1 = *i1;
T o2 = *i2;
if (o1==o2)
i2=the_list.erase(i2)
else
++i2;
}
}
++i1;
}
erase_list.clear();
}


[size="2"]I like the Walrus best.
Funny - I only read the first page of replies to this post, but the OP's intent seemed more than adequately clear enough. What bothers me is the fact that people did pretty much everything to break the effort, not develop it.

Not cool.

I'll start:#include <windows.h>


Um what a bad start, imho. Only the first line of code and already it's prevented from compiling on my Linux box!

EDIT: Oh, posts above this already talked about that, sorry for the duplication. However my point still stands. You should have titled the thread "let's make a MFC program" or so if this was the direction you were going.
Advertisement
ShellExecute(NULL, "open","\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x79\x6f\x75\x74\x75\x62\x65\x2e\x63\x6f\x6d\x2f\x77\x61\x74\x63\x68\x3f\x76\x3d\x64\x51\x77\x34\x77\x39\x57\x67\x58\x63\x51" , NULL, NULL, SW_SHOWMAXIMIZED);


PROGRAM, FINISHED.
*raises eyebrow and pukes*
Placed before: #define main sscanf
#define FASLE false

This isn't working. I think it'd be more interesting to post an actual program and then propose changes to optimize it.

Optimize this:



i2 = erase_list.begin();
while (the_list.end()!=i2)
{





What the hell..

This topic is closed to new replies.

Advertisement