Can someone please o please tell me a program to make? I am very bored. But make it sorta easy. I started learning about a week ago. I know cout, cin, int, char, and other small doodads I think. Thanks!
Printable View
Can someone please o please tell me a program to make? I am very bored. But make it sorta easy. I started learning about a week ago. I know cout, cin, int, char, and other small doodads I think. Thanks!
How about playing around with a new concept: arrays?
int my_array[3];//creates 3 int variables, with index values 0, 1, 2
my_array[0]=10;
my_array[1]=20;
my_array[2]=30;
cout<<my_array[0]<<endl;
cout<<my_array[1]<<endl;
cout<<my_array[2]<<endl;
Mmm...arrays. How about making a 3D game like Quake? ;)
Do you have mad loop skillz? Try outputting this:
Code:*
**
***
****
*****
Lol, i am working on quake4. lol. those progs look cool, arrays i think r too advanced, and i dont know loops. well, a lil lil if....else.
You'll have to beat me to Quake 4. Actually, mine's going to be so good, I'm calling it Quake 5.Quote:
Originally posted by oobootsy1
Lol, i am working on quake4. lol. those progs look cool, arrays i think r too advanced, and i dont know loops. well, a lil lil if....else.
Anyway, loops are really easy to learn, and arrays aren't too difficult. Check out the tutorials on this site.
You could also make a very basic text-adventure with a couple rooms.
Just knowing a little I/O won't get you very far. Loops are really cool and fun (did I mention fun?). Check out these tutorials
if and else aren't loops, loops are while, do while, and for.
Play with those, check out the tutorials for more help.Code:for (int i = 0; i < 10; ++i)
{
cout << i << "\n";
}
while (v1 != v2)
{
++v1;
}
do
{
++v1;
}
while (v1 != v2);
Quote:
Originally posted by funkydude9
Just knowing a little I/O won't get you very far. Loops are really cool and fun (did I mention fun?). Check out these tutorials
whats I/O? ok, ima look at tuts on loops. and what did u mean by making a text adventure with "rooms"?
Input & output
well i did make this yesterday. kinda cool.........
Code:#include <iostream.h>
void main()
{
int age;
char name;
int weight;
char hair;
{
cout << "Welcome! I will need some information about you!";
cout << "\nPlease enter your first letter of your name: ";
cin >> name;
cout << "\nPlease enter your age: ";
cin >> age;
cout << "\nPlease enter your weight: ";
cin >> weight;
cout << "\nFinally, Please enter your first letter of your hair color: ";
cin >> hair;
cout << "\nOK! Your freakin name starts with a: " << name << "!";
cout << "\nYou are " << age << " years old!";
cout << "\nYou weigh " << weight << " pounds!";
cout << "\nAnd the first letter of your ugly hair color is: " << hair << "!";
cout << "\n Thanks! Have a nice day!";
cout << "\n..........I wish char can hold more letters.....*sigh*";
}
}
and whats the difference between int and void? the faq was too confusing
int returns an integer to main(), void returns nothing to main() (or whoever called the function).Quote:
and whats the difference between int and void? the faq was too confusing
Or did you mean int main() or void main()?
I'm sure these people will tell you, never, EVER use void main(), only int main(). :)
well, lemme try that
*
**
***
thing some1 said in a loop. i well probably be back in a minute saying i cant make it, too hard. well, here i go.........
You'll need to use nested loops. (a loop inside of a loop).Quote:
well, lemme try that
*
**
***
thing some1 said in a loop. i well probably be back in a minute saying i cant make it, too hard. well, here i go.........
i new it. i thought i could do it. but i dunno how to make *'s. only numbers. anyways, it errors.
Code:#include <iostream.h>
void main()
{
int x=0
while(x<6)
{
cout << x << endl;
x++;
}
}