954,184 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Programming -- a group effort

Here is how you play, I will start. I write one line of the program, and each next poster can add ONE more line to it. Come on all you geeks out there, lets do it!

int main()
{


}
MIGSoft
Posting Pro in Training
473 posts since Jul 2005
Reputation Points: 10
Solved Threads: 2
 

int main()
{
#include
int num

cout << "enter number";
cin >> num;

return o;

}

jbennet
Moderator
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,820
Solved Threads: 600
 

Ok now it compiles (missing ; and include pre-processor moved to correct position, using namespace added, return o changed to return 0), one line at a time only and must compile.

Single statements and variable declarations no problem.

To start a function start with the declaration by adding as a comment (eg //void somefunction(int param); next guy starts a stub again as a comment //void blah... , when it's a compilable stub next guy can remove comments, then next guy (or gal of course) can start adding statements ONE line at a time only..

#include <iostream.h>

using namespace std;

//char charNum(int num);

int main()
{

int num;

cout << "enter number";
cin >> num;

return 0;

}
hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68
 
#include <iostream.h>

using namespace std;

//char charNum(int num);

int main()
{

int num;

cout << "enter number";
cin >> num;
num = num *2;
return 0;

}
MIGSoft
Posting Pro in Training
473 posts since Jul 2005
Reputation Points: 10
Solved Threads: 2
 
#include <iostream.h>

using namespace std;

//char charNum(int num);

int main()
{

int num;

cout << "enter number ";
cin >> num;
num = num *2;
cout << "I doubled your number: " << num << "\n"; cin.ignore(); cin.get();
return 0;

}


Thinks: Explore the entire iostream library one line at a time? might be useful for noobs browsing for C++ stuff.

hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68
 

Try entering 1073741824 at the prompt, C++ is not as good at maths as you might think! now why is that I wonder ?

hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: