Page 1 of 2

My first C++ Program!

PostPosted: Sat Mar 11, 2017 6:16 pm
by whos sayin
I started learning c++ a few weeks ago and i made my first program. You guys should recognize it.

#include <iostream>
using namespace std;
int main(){
string p,c,f ;

while (true){

cout << "what is your name?\n" ;

cin >> c ;

if (f==c) {
cout << p << " just got a point!\n\n" ;
}

cout << "your next guess?\n" ;

cin >> f ;

p=c ;

}
return 0;
}


Also if anyone knows c++ can you help me find whats wrong with this tic-tac-toe game? it was fine until i added the scoring system. Its quite long and could be shortened so much with switch commands but i forgot how to use them while making it. I used a lot of copy pasting.
https://code.sololearn.com/cHzKpH14NrLg/#cpp

Re: My first C++ Program!

PostPosted: Sun Mar 12, 2017 8:24 am
by mathwhiz9
Very nice :D

I'd try to help you, by I'm a very new beginner and I've only learned a bit of java. But good luck

Re: My first C++ Program!

PostPosted: Sun Mar 12, 2017 9:00 am
by zyxe
Looks like fun! Thanks to my schools computer class, I've done all the lessons using Codecademy for both Html and Javascript. Currently working on Python. Sadly, I don't know any C++ but maybe I could give it just in case.

Re: My first C++ Program!

PostPosted: Mon Mar 13, 2017 4:33 am
by whos sayin
zyxe wrote:Looks like fun! Thanks to my schools computer class, I've done all the lessons using Codecademy for both Html and Javascript. Currently working on Python. Sadly, I don't know any C++ but maybe I could give it just in case.

My school has like 100 electives to choose from but none of them are coding. I'm just learning online right now

Re: My first C++ Program!

PostPosted: Mon Mar 13, 2017 4:34 am
by whos sayin
mathwhiz9 wrote:Very nice :D

I'd try to help you, by I'm a very new beginner and I've only learned a bit of java. But good luck


Did you figure out what it does?

Re: My first C++ Program!

PostPosted: Mon Mar 13, 2017 9:07 am
by bleatingsheep39
What even is this program...

Re: My first C++ Program!

PostPosted: Mon Mar 13, 2017 2:07 pm
by coltspaesano
bleatingsheep39 wrote:What even is this program...

It's TPBM sheep!

Re: My first C++ Program!

PostPosted: Fri Mar 17, 2017 3:39 am
by whos sayin
Hwy guys, in gonna make an RPG style game now. Can someone draw out a floor map of a house or building for it to be set in? I got a bunch of ideas about how the mechanics will work

Re: My first C++ Program!

PostPosted: Thu Mar 23, 2017 5:43 pm
by r10t--
Heyo,

3rd year software engineering student here!

//Ignore this stuff vvvvvvv
The error is that when you check victory conditions you don't check all of the possible win conditions. Take for example variable a. Look at line 177. What happens if a player gets a win down the left side of the board? That would be tiles a, d, g. Your if statement never checks for that case. Make sure it considers all of the possible cases.
//Ignore this stuff ^^^^^^

I'll be back with a surprise for you

Edit: I looked at your code. The error is actually very simple. Just add #include <string> at the top of your program and it will work just fine! Strings need to be included as they are not a standard variable type.

Re: My first C++ Program!

PostPosted: Thu Mar 23, 2017 5:52 pm
by zyxe
whos sayin wrote:Hwy guys, in gonna make an RPG style game now.

I hope you are still working on that, even if no one got you floor plans.

r10t-- wrote:I'll be back with a surprise for you

Building that suspense.