Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<stdio.h>
- #include<string.h>
- using namespace std;
- void reverse_words(char abc[200])
- {
- int i,s,a=0,l;
- l=strlen(abc);
- for(i=0;i<=l;i++)
- {
- if((abc[i]==' ') || (abc[i]=='\0'))
- {
- for(s=i;s>=a;s--)
- {
- cout<<abc[s];
- }
- a=i;
- }
- }
- }
- int main()
- {
- char a[200];
- cout<<"Enter the string : ";
- gets(a);
- reverse_words(a);
- return 0;
- }
Add Comment
Please, Sign In to add comment