?

closed account (28UMizwU)
/???
Last edited on
= is the assignment operator
a = b; assigns the value of b to a.

To test for equality, you need to use == not = .

Also, proper indentation is important for clarity.
http://www.cplusplus.com/forum/beginner/65839/
Last edited on
closed account (28UMizwU)
i changed this and now it says I did not assign the variables x,b,and f even though I want them to be user inputs
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
27
28
29
30
31
32
33
34
35
36
#include <iostream>

int main( ) {

    //Declare all Variables Here
    int size;
    char shape;       //f-> forward b->backward x->cross

    //Input or initialize values Here
    std::cout << "Create a numbered shape that can be sized.\n"
              << "Input an integer number [1,50] and a character [x,b,f].\n" ;
    std::cin >> size >> shape ;

    if( size < 1 || size > 50 ) {

        std::cout << "error: invalid size. not in [1,50]\n" ;
        return 1 ;
    }

    if( shape == 'x' ) { // note the quotes: literal character 'x'  

       // x : draw shape cross\n
    }

    else if( shape == 'b' ) {

       // b : draw shape backslash
    }

    else if( shape == 'f' ) {

       // f : draw shape slash
    }

    else std::cout << "error: invalid shape. not one of [x,b,f]\n" ;
}
Topic archived. No new replies allowed.