ShiqiYu / CPP

Lecture notes, projects and other materials for Course 'CS205 C/C++ Program Design' at Southern University of Science and Technology.
2.07k stars 351 forks source link

`*` will be translated to wildcard in bash and other terminals and so on. #51

Closed Xuanyiyiren closed 3 weeks ago

Xuanyiyiren commented 3 weeks ago

I am an undergraduage student major in physics, and I am new to computer science. I am recently learning C++ course given by Prof.Yu and trying to finish Yu's projects.

But in the first project, Prof.Yu give an example of the program like this

$./calculator 2 + 3
2 + 3 = 5
$./calculator 2 - 3
2 - 3 = -1
$./calculator 2 * 3
2 * 3 = 6
$./calculator 2 / 3
2 / 3 = 0.66666667

However, the terminals will treat as wildcard, and when I input "2 3", I find the main function get more then 4 argements, and most of them are files' names in the same content.

How do I solve this question? My solution is using x to replace *, is that a good adjustment?

ShiqiYu commented 3 weeks ago

Yes, you can do in that way.