Inspiration
Programming is the one that attracts me the most. from being not from technical field to being able to code in different programming languages inspires more to work hard. problem solving, web or app development is all what catches me.
What it does
the code below reversed a string, for example if the string is deeksha then the output will be ahskeed.
How we built it
first I put header file into our code then I declared our main function then I took two arrays of character data type. then we declared three variables and input from the user for string in the character array. then i find the length of the string using while loop. then we ran a for loop to reverse the array. here i is indicating to the first element of new array and j is indicating the last element of the input array
Challenges we ran into
there are other approach but i find it the most optimised
Accomplishments that we're proud of
we are able to find the reverse of any string
What we learned
we learnt taking string input , counting array length and logic to reverse any string.
What's next for reverse string'
//program to reverse a string in C++
include
using namespace std; int main() { char str[1000], rev[1000]; int i, j, count = 0; cin >> str;
//finding the length of the string by counting while (str[count] != '') { count++; } j = count - 1;
//reversing the string by swapping for (i = 0; i < count; i++) { rev[i] = str[j]; j--; } cout << rev; }
Log in or sign up for Devpost to join the conversation.