I'm working on a C++ program that will take something the user typed in and convert it to morse code. The program converts what the user typed in character by character.
However, I don't now if there is a way to do that character by character, basically a C++ equivalent to C#'s foreach loop.
Here are some code samples of what the loop would look like in other languages, one in Python and one in C#.
Python:
inventory = ["sword", "potion", "shield"]
for item in inventory:
print(item)
Is there a C++ equivelant to C#'s foreach loop?
I'm working on a C++ program that will take something the user typed in and convert it to morse code. The program converts what the user typed in character by character.
However, I don't now if there is a way to do that character by character, basically a C++ equivalent to C#'s
foreach
loop.Here are some code samples of what the loop would look like in other languages, one in Python and one in C#.
Python:
C#:
Basically, I want to know if there's a way to do something like that in C++.
Code:
@Bookie0 Thanks. It worked.