[Solved] if/else statement doesn’t work c++ [closed]


if (name[0] = 'M')

should have to be

if (name[0] == 'M')

= is used as an assignment operator. it will assign M to name[0].
Use == to compare value.

= assign value from right hand side to left hand side.
== compare value of right hand side with left hand side.

solved if/else statement doesn’t work c++ [closed]