Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void stringReverse(char stringToReverse[], int startSubscript);
- int main()
- {
- int leng=0;
- int i=0;
- char myWord[50]="";
- cout<<"Please enter a string: ";
- cin.getline(myWord,50);
- while(myWord[i]!=NULL)
- {
- leng++;
- i++;
- }
- stringReverse(myWord, leng);
- return 0;
- }
- void stringReverse(char stringToReverse[], int startSubscript)
- {
- for(int i=startSubscript-1;i>=0;i--)
- {
- cout<<stringToReverse[i];
- }
- cout<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement