Using a basic C++ code to reverse a string using an additional storage array
What it does
It reverses a string by storing characters from one array into another.
How we built it - Well I build it using C++ compiler, Vs Code but you can use any IDE.
Challenges we ran into - None
Accomplishments that we're proud of
What we learned
What's next for Reverse a string
Code- ``` #include using namespace std; int main() { string s; cin >> s; string rev; int n = s.size(); for (int i = 0; i < s.size(); i++) { rev[i] = s[n - i - 1]; } for (int i = 0; i < rev.size(); i++) { cout << rev[i] << " "; } cout << endl; return 0; }
Built With
- c++
- vscode
Log in or sign up for Devpost to join the conversation.