Since the focus of my C# thread changed to C++, I decided to make this thread so the other thread can get back on focus to C#.
You post almost anything that has to do with C++ here.
If you don't know C++, you can go here: http://www.cplusplus.com/doc/tutorial
Offline
Here is a madlib made by gershmer that I ported into C++
#include <iostream>
#include <string>
#include <conio>
using namespace std;
int main ()
{
string mlnoun, mladjec;
int mlnum;
cout << "Noun: ";
cin >> mlnoun;
cout << "\nAdjective: ";
cin >> mladjec;
cout << "\nNumber: ";
cin >> mlnum;
cout << "\n\nWelcome to my " << mlnoun << ".\nIt is " << mladjec << ".\nPay me $" << mlnum << " or else!";
cout << "\n\nPress any key to close.";
getch();
return 0;
}Last edited by ThePCKid (2010-04-27 19:09:02)
Offline
ThePCKid wrote:
Here is a madlib made by gershmer that I ported into C++
Code:
#include <iostream> #include <string> #include <conio> using namespace std; int main () { string mlnoun, mladjec; int mlnum; cout << "Noun: "; cin >> mlnoun; cout << "\nAdjective: "; cin >> mladjec; cout << "\nNumber: "; cin >> mlnum; cout << "\n\nWelcome to my " << mlnoun << ".\nIt is " << mladjec << ".\nPay me $" << mlnum << " or else!"; cout << "\n\nPress any key to close."; getch(); return 0; }
Oh my gosh. Thanks for porting it to C++, what would I do with it, though?
Offline
gershmer wrote:
ThePCKid wrote:
Here is a madlib made by gershmer that I ported into C++
Code:
#include <iostream> #include <string> #include <conio> using namespace std; int main () { string mlnoun, mladjec; int mlnum; cout << "Noun: "; cin >> mlnoun; cout << "\nAdjective: "; cin >> mladjec; cout << "\nNumber: "; cin >> mlnum; cout << "\n\nWelcome to my " << mlnoun << ".\nIt is " << mladjec << ".\nPay me $" << mlnum << " or else!"; cout << "\n\nPress any key to close."; getch(); return 0; }Oh my gosh. Thanks for porting it to C++, what would I do with it, though?
I don't know, but if you put the code in a C++ compiler and compile it, you can run your madlib offline!
Offline
I love computers, but I don't know very much about programming itself. For example, where do I compile these C++ programs at? It seems like something I could learn.

Offline
I'll come back tomorrow.
CURSE YOU, SIXTY SECOND RULE! MAY YOU ROT IN A CAVE IN THE MIDDLE OF NOWHERE LISTENING TO BARNEY CD'S UNTIL THE END OF TIME!

Offline
Here is a quick program/tool that I made that sees if a number is even or odd
#include <iostream>
void main ()
{
int numb;
std::cout << "Type in a number (0 to exit): ";
std::cin >> numb;
if (numb != 0)
{
if (numb%2 = 0)
std::cout << numb << " is an even number.\n";
else
std::cout << numb << " is an odd number.\n";
main ();
}
else
exit (0);
}Offline
TheGenius95 wrote:
I love computers, but I don't know very much about programming itself. For example, where do I compile these C++ programs at? It seems like something I could learn.
There are many compilers out there.
Try Googling "C++ compiler"
Offline
ThePCKid wrote:
TheGenius95 wrote:
I love computers, but I don't know very much about programming itself. For example, where do I compile these C++ programs at? It seems like something I could learn.
There are many compilers out there.
Try Googling "C++ compiler"
Okay!

Offline
gershmer wrote:
ThePCKid wrote:
Here is a madlib made by gershmer that I ported into C++
Code:
#include <iostream> #include <string> #include <conio> using namespace std; int main () { string mlnoun, mladjec; int mlnum; cout << "Noun: "; cin >> mlnoun; cout << "\nAdjective: "; cin >> mladjec; cout << "\nNumber: "; cin >> mlnum; cout << "\n\nWelcome to my " << mlnoun << ".\nIt is " << mladjec << ".\nPay me $" << mlnum << " or else!"; cout << "\n\nPress any key to close."; getch(); return 0; }Oh my gosh. Thanks for porting it to C++, what would I do with it, though?
Here is a new version:
#include <iostream>
#include <string>
#include <conio>
using namespace std;
void main ()
{
string mlnoun, mladjec;
int mlnum;
cout << "Noun: ";
std >> mlnoun;
cout << "Adjective: ";
std >> mladjec;
cout << "Number: ";
std >> mlnum;
cout << "\n\nWelcome to my " << mlnoun << ".\nIt is " << mladjec << ".\nPay me $" << mlnum << " or else!";
cout << "\n\nPress any key to exit.";
getch();
exit (0);
}It fixes a bug
Offline
Here is a calculator that I made in C++
#include <iostream>
#include <conio>
using namespace std;
void main ()
{
int num1, num2;
char oper;
float result;
cout << "Type in a number: ";
cin >> num1;
cout << "\nType in an operator (+, -, /, *, %): ";
cin >> oper;
cout << "\nType in another number: ";
cin >> num2;
if (oper == '+')
result = num1 + num2;
else if (oper == '-')
result = num1 - num2;
else if (oper == '/')
result = num1 / num2;
else if (oper == '*')
result = num1 * num2;
else if (oper == '%')
result = num1 % num2;
else
result = 0;
cout << "\n" << num1 << oper << num2 << "=" << result;
cout << "\n\nPress any key to make another calculation.";
getch();
cout << "\n\n";
main ();
}Last edited by ThePCKid (2010-04-28 08:27:11)
Offline
Sorry for bumping.
#include <iostream>
#include <conio>
using namespace std;
int num;
void main ()
{
cout << "Enter a number between 1 and 3: ";
cin >> num;
if (num == 1)
cout << "Hi Bob!";
else if (num == 2)
cout << "Hi Sheldon!";
else if (num == 3)
cout << "Hi Christoper!";
else
cout << num << " is not between 1 and 3.";
cout << "\nPress any key to exit";
getch();
exit (0);
}The power of bordem has struck again!
C# version
Last edited by ThePCKid (2010-05-01 22:46:25)
Offline
fanofcena wrote:
Finally home sweet home!!!!!!!!!!!! i mean C++ forum
![]()
btw c++ begginers can also ask us![]()
Thats right!
Offline
PC kid are u intrested in development of a header like Scratch.h with all basic functions of scratch i did the spite making part , Flow of control and variables can be derived from C++ basic but the other fucntions like ghost effect, ask , sound etc are u intrested in developing such thing??
Offline
fanofcena wrote:
PC kid are u intrested in development of a header like Scratch.h with all basic functions of scratch i did the spite making part , Flow of control and variables can be derived from C++ basic but the other fucntions like ghost effect, ask , sound etc are u intrested in developing such thing??
Yes!
Offline
ThePCKid wrote:
fanofcena wrote:
PC kid are u intrested in development of a header like Scratch.h with all basic functions of scratch i did the spite making part , Flow of control and variables can be derived from C++ basic but the other fucntions like ghost effect, ask , sound etc are u intrested in developing such thing??
Yes!
OOpz i didnt showed on scratch server since that message nicely sorry ma mistake ::
Well PC KID i want to know how much c++ u know be frank jst tell me i am happy to teach i might write an article on how to code on C++ teaching young brains basic of analysing the code they write on C++ . I hope we do it ASAP so far here is how to handle that
functions :: the basic functions that are not in C++ so leave set variable , and controls
Sprite :: A sprite can be considered as a structure
like
struct Picture// Our own image format lol
{ int x[900];
int y[900]
int color[900];
};
// now thats actually information of image for maximum 900 pixels We will increase it later
struct Position
{ int Xpos;
int Ypos;
};
sturct Sprite{
picture Costumes[10]; // say 10 costumes for the sprite we can write infinite list as //well but i am not sure u are aware with pointers or not
Position Pos;
int Pen;// this stores if a pen is down or not jst a 0 or Anything variable
int Show?;// same as pen but decides if to show the sprite
int Graphiceffects[10][1]; //The 10 graphic effects with amount they are used for this
};tats jst a basic example but we have to build over on this skeleton ok?? cuz when its done i can simply write a C++ compiler for scratch projects lol
Offline