473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Reverse each word of a string ??

Faizzz
6
Can anyone show me the code to reverse each word of a string
example: If input is:
I live in America

The resultant output should be:
I evil ni acirema
Without using string reverse
Nov 6 '13 #1
2 1562
divideby0
131 128KB
By string, do you mean a std::string or a terminated char array?

Either way, try breaking the string around any spaces and working with sub strings. With each sub string, you can use a loop to copy the contents backward.

post your code
Nov 6 '13 #2
donbock
2,426 Expert 2GB
@Faizzz: all you've done is written out your homework assignment and asked us to do it for you. Refer to our homework policy; that isn't what we do here.

You need to try and set up the solution yourself. We can help you overcome specific obstacles you encounter.
Nov 7 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

24
by: Sathyaish | last post by:
This one question is asked modally in most Microsoft interviews. I started to contemplate various implementations for it. This was what I got. #include <stdio.h> #include <stdlib.h> #include...
13
by: Aamir Mahmood | last post by:
What could be the fastest method to reverse a string. Speed really matters for my application. Average size of string that comes to my function is around 200K - 300K. Currently i am using the...
47
by: sudharsan | last post by:
could any one please give me a code to reverse a string of more than 1MB .??? Thanks in advance
8
by: Gregory Piñero | last post by:
Is my mind playing tricks on me? I really remember being able to reverse a string as in: text='greg' print text.reverse() Is it possible thats in some Python install and not in others? I...
41
by: rick | last post by:
Why can't Python have a reverse() function/method like Ruby? Python: x = 'a_string' # Reverse the string print x Ruby: x = 'a_string' # Reverse the string
1
by: junglenut | last post by:
please give me a reverse word java program in a form of jcreator javax.swing.*; source code.. because i really have a hard time figuring it out on how to make it.. please give me a reverse word...
15
by: rajash | last post by:
Thanks for the additional comments. Here is a solution to an exercise I had problems with. I still don't think it's really what's wanted as it uses a "state variable" n - but I can't see how to...
2
by: alireza6485 | last post by:
Hello every one: I have to write a program that reverse and displays the charactors of a pharase typed from the keyboard. This is what I wrote: using System; public class YourName { public...
2
by: anand vishwakar | last post by:
Hi all, I prepared a program in c language to reverse a string using recursive function In my program I terminated the string using new line character '\n' But I want to change my program...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.