Multiply char by integer (c++)

后端 未结 6 666
甜味超标
甜味超标 2020-12-31 16:03

Is it possible to multiply a char by an int?

For example, I am trying to make a graph, with *\'s for each time a number occurs.

So something like, but this d

6条回答
  •  执念已碎
    2020-12-31 16:29

    the way you're doing it will do a numeric multiplication of the binary representation of the '*' character against the number 7 and output the resulting number.

    What you want to do (based on your c++ code comment) is this:

    char star = '*';
    int num = 7;
    for(int i=0; i

提交回复
热议问题