My first C++ Program!

Just shooting the breeze
Sat Mar 11, 2017 6:16 pm

  • 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
    My new party trick:
    I swallow 2 pieces of string and an hour later they come out of my ass tied together.
    I shit you knot.
    User avatar
    whos sayin
     
    Posts: 631
    Joined: Wed May 25, 2016 5:27 pm
    Location: N korea

Sun Mar 12, 2017 8:24 am

  • 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
    Loki: I have an army!
    Tony Stark: We have a Discord.

    Earth's Mightiest Discord Server!

    A new challenger appears! Come join the revolution!

    P.S. Those are actually 3 different links!
    User avatar
    mathwhiz9
     
    Posts: 3340
    Joined: Sun Nov 08, 2015 7:22 pm
    Location: The Great White North

Sun Mar 12, 2017 9:00 am

  • 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.
    Zyxe? Now that is a name I haven't heard in a long time.
    User avatar
    zyxe
     
    Posts: 833
    Joined: Wed Nov 18, 2015 10:12 am

Mon Mar 13, 2017 4:33 am

  • 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
    My new party trick:
    I swallow 2 pieces of string and an hour later they come out of my ass tied together.
    I shit you knot.
    User avatar
    whos sayin
     
    Posts: 631
    Joined: Wed May 25, 2016 5:27 pm
    Location: N korea

Mon Mar 13, 2017 4:34 am

  • 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?
    My new party trick:
    I swallow 2 pieces of string and an hour later they come out of my ass tied together.
    I shit you knot.
    User avatar
    whos sayin
     
    Posts: 631
    Joined: Wed May 25, 2016 5:27 pm
    Location: N korea

Mon Mar 13, 2017 9:07 am

  • What even is this program...
    Baa.
    bleatingsheep39
     
    Posts: 809
    Joined: Thu Feb 25, 2016 11:11 pm
    Location: In the pasture.

Mon Mar 13, 2017 2:07 pm

  • bleatingsheep39 wrote:What even is this program...

    It's TPBM sheep!
    A wise guy's always right; even when he's wrong he's right
    -Lefty, Donnie Brasco
    400th Page TPBM
    User avatar
    coltspaesano
     
    Posts: 585
    Joined: Thu Sep 29, 2016 9:10 am

Fri Mar 17, 2017 3:39 am

  • 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
    My new party trick:
    I swallow 2 pieces of string and an hour later they come out of my ass tied together.
    I shit you knot.
    User avatar
    whos sayin
     
    Posts: 631
    Joined: Wed May 25, 2016 5:27 pm
    Location: N korea

Thu Mar 23, 2017 5:43 pm

  • 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.
    Last edited by r10t-- on Thu Mar 23, 2017 6:58 pm, edited 2 times in total.
    R10t--
    Software Engineering student by day, avid gamer by night.
    r10t--
     
    Posts: 345
    Joined: Fri Oct 16, 2015 6:11 am

Thu Mar 23, 2017 5:52 pm

  • 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.
    Zyxe? Now that is a name I haven't heard in a long time.
    User avatar
    zyxe
     
    Posts: 833
    Joined: Wed Nov 18, 2015 10:12 am

Next


Return to Off topic and social




Information
  • Who is online
  • Users browsing this forum: No registered users and 21 guests
cron