trying to output the word left it's important

See the code in the middle, I'm trying to make guess1 (if passes test) equal left so when it goes in cout guess1 is really left and left prints at least "l" little own "left"....and do I use a string to get the full word from ('left')?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <ctime>

using namespace std;

int main()
{
    srand( time(0));
    int guess1 = rand();
    int guess2 = rand();
    int guess3 = rand();
    int guess4 = rand();

    char left('l');
    if (guess1 < 50000)
    guess1 = left;

    cout << "Leg 1 moved " << guess1 << endl;
    cout << "Leg 2 moved " << guess2 << endl;
    cout << "Leg 3 moved " << guess3 << endl;
    cout << "Leg 4 moved " << guess4 << endl;

    return 0;
}
Last edited on
Topic archived. No new replies allowed.