C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 2nd, 2012, 08:40 PM
sankav sankav is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 2 sankav User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 57 sec
Reputation Power: 0
File and String Manipulation

Would Really Appreciate any help!!!!!!!!
I am a newbee in programming and finding this to be a very tricky question.

Need help to write a C program that will create scrambled words by circularly rotating the middle characters of each word by 1 character.
Place the scrambled words, 1 per line in an output file.

Example:
sunday becomes sndauy

The Input File format is such that the first line contains a number indicating the number of words in the file, followed by one line for every word to be scrambled (no spaces in any of the words).

Sample input file:
3
hut
create
ready
people

Sample output file:
hut
ceatre
radey
poplee

Reply With Quote
  #2  
Old December 2nd, 2012, 10:11 PM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,367 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 11 h 16 m 5 sec
Reputation Power: 383
How do you get the input and output file names?
I'd use stdin and stdout with command line redirection, as in
$ myprogram < wordlist.txt > scrambled.txt

You'll assuredly respond that that is illegal. Even so, it might be a good start.

Can you write a program that copies input to output?
Opens a file for reading or for writing?

Why is people scrambled in your output example?
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
  #3  
Old December 3rd, 2012, 11:20 AM
sankav sankav is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 2 sankav User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 57 sec
Reputation Power: 0
Hi, thanks for responding..

I would create the text files, one for input and one for output.
The program has to read the files from The input text file (e.g. input.txt) and write the scrambled words to output file (e.g output.txt)

The scramble words are created by circularly rotating the middle characters of each word by 1 character.
That is how all the words are shown including "people"in the previous example.

I have tried coding and my program is all over in bits and pieces .

Would really appreciate your response.

Reply With Quote
  #4  
Old December 3rd, 2012, 12:10 PM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,367 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 11 h 16 m 5 sec
Reputation Power: 383
Please post your effort so we can review. Follow the link at my signature for advice about how to post code. Thanks.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > File and String Manipulation

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap