Multiply char by integer (c++)

后端 未结 6 674
甜味超标
甜味超标 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:39

    The statement should be:

    char star = "*";
    

    (star * num) will multiply the ASCII value of '*' with the value stored in num

    To output '*' n times, follow the ideas poured in by others.

    Hope this helps.

提交回复
热议问题