Quick Search for:  in language:    
scrambles,every,letter,word,except,first,last
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
C/ C++ Stats

 Code: 715,766. lines
 Jobs: 107. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login





Latest Code Ticker for C/ C++
Click here to see a screenshot of this code!c++ basic all
By Hamdi Farah on 1/28

(Screen Shot)

biopro.c --- search for words that do not exist in the dictionary file
By Donald Bono on 1/28


BruteForce Engine
By koby-GR on 1/28


Catch Me If U Can !!
By ashish & manas on 1/27


nOS ver 1.0
By - Snake - on 1/27


WordInFile.c -- look up a dictionary file for the word you just entered (source code only)
By Donald Bono on 1/27


WordInList.EXE -- search a dictionary file (included)
By Donald Bono on 1/27


Alymars Dice Roller
By roy sawyer III on 1/26


LCI_EXPORTER
By Leandro Pelorosso on 1/26


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

cambridge study

Print
Email
 
VB icon
Submitted on: 12/14/2003 10:24:38 PM
By: Kyle T Clary 
Level: Intermediate
User Rating: Unrated
Compatibility:Microsoft Visual C++

Users have accessed this code 435 times.
 
(About the author)
 
     scrambles every letter in the word except for the first and last letter
 

INCLUDE files:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!

//**************************************
//     
//INCLUDE files for :cambridge study
//**************************************
//     
apstring.h and apstring.cpp are needed to compile
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

//**************************************
//     
// Name: cambridge study
// Description:scrambles every letter in
//     the word except for the first and last l
//     etter
// By: Kyle T Clary
//
// Inputs:a text file with words
//
// Returns:a text file with scrambled wo
//     rds
//
// Assumes:Aoccdrnig to a rscheearch at 
//     an Elingsh uinervtisy, it deosn't mttaer
//     in waht oredr the ltteers in a wrod are,
//     the olny iprmoetnt tihng is taht frist a
//     nd lsat ltteer is at the rghit pclae. Th
//     e rset can be a toatl mses and you can s
//     itll raed it wouthit porbelm. Tihs is bc
//     useae we do not raed ervey lteter by its
//     lef but the wrod as a wlohe
i saw this on a message board and thought it was cool so i wrote a program that does the same thing
//
//This code is copyrighted and has// limited warranties.Please see http://
//     www.Planet-Source-Code.com/vb/scripts/Sh
//     owCode.asp?txtCodeId=7291&lngWId;=3//for details.//**************************************
//     

#include<iostream.h>
#include<apstring.h>
#include<fstream.h>
#include<stdlib.h>
#include<time.h>
int main()
    {
    	ifstream fin; ofstream fout;
    	apstring filename, word;
    	char temp;
    	int randnum;
    	srand(time(NULL));
    	cout<<"Enter name of file to convert: ";
    	cin>>filename;
    	fin.open(filename.c_str());
    	fout.open("jumble.txt");
    	fin>>word;
    	while(!fin.eof())
        	{
        		if(word[word.length()-1]==',' || word[word.length()-1]=='.' || word[word.length()-1]=='?' || word[word.length()-1]=='!' || word[word.length()-1]=='*' || word[word.length()-1]=='%')
        		{											//end of word in apstring changes with added punctuation
        			for(int i=1;i<word.length()-3;i++)
            			{
            				randnum=rand()%2;
            				temp=word[i];
            				word[i]=word[i+randnum];
            				word[i+randnum]=temp;	
            			}
            			for(i=1;i<word.length()-3;i++)					//word is randomly scrambled 3 times
                			{
                				randnum=rand()%2;
                				temp=word[i];
                				word[i]=word[i+randnum];
                				word[i+randnum]=temp;	
                			}
                			for(i=1;i<word.length()-3;i++)
                    			{
                    				randnum=rand()%2;
                    				temp=word[i];
                    				word[i]=word[i+randnum];
                    				word[i+randnum]=temp;	
                    			}
                    			fout<<word << " ";
                    			fin>>word;
                    		}
                    		else	//for word without punctuation at the end
                    		{												
                    			for(int i=1;i<word.length()-2;i++)
                        			{
                        				randnum=rand()%2;
                        				temp=word[i];
                        				word[i]=word[i+randnum];
                        				word[i+randnum]=temp;
                        			}
                        			for(i=1;i<word.length()-2;i++)
                            			{
                            				randnum=rand()%2;
                            				temp=word[i];
                            				word[i]=word[i+randnum];				//word is randomly scrambled 3 times
                            				word[i+randnum]=temp;
                            			}
                            			for(i=1;i<word.length()-2;i++)
                                			{
                                				randnum=rand()%2;
                                				temp=word[i];
                                				word[i]=word[i+randnum];
                                				word[i+randnum]=temp;
                                			}
                                			fout<<word << " ";
                                			fin>>word;
                                		}
                                	}
                                	fin.close();
                                	fout.close();
                                	return 0;
                            }

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments

 There are no comments on this submission.
 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | C/ C++ Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.