Sie sind auf Seite 1von 4

A simple strings sorting by Tahseen http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCode...

Code/Articles » | Newest/Best » | Community » | Jobs » | Other » | Goto » |


C/ C++ Stats

Code: 1,244,614. lines


Jobs: 173. postings

How to support the site

Sponsored by:

Quick Search for: in language:

You are in:


Print
A simple strings sorting
Email
Login (About the
Submitted on: 4/13/2002 9:31:53 AM
author)
By: Tahseen
Level: Beginner
User Rating: By 4 Users
Compatibility:C, C++ (general), Microsoft
Visual C++, Borland C++

Users have accessed this code 35443 times.

This code will make you understand simple by accepting 4 strings and
sorting it through Bubble sort i trust this u help for C and C++ Beginner.

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

//**************************************
//
//INCLUDE files for :A simple strings so
// rting
//**************************************
//
#include <iostream.h>
#include <string.h>

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: A simple strings sorting
// Description:This code will make you u
// nderstand simple by accepting 4 strings
Latest postings for C/ // and sorting it through Bubble sort i tru
C++. // st this u help for C and C++ Beginner.
// By: Tahseen
Simple Payroll
Syste Using Object
//
Oriented Programming // Inputs:Ask to enter 4 strings
By Jake Rodriguez //
Pomperada on 3/8 // Returns:returns sorting strings
//
(Screen Shot)
// Assumes:User should be aware of Array
// s, boolean,for loops.
Black Jack OOP
By Micu Danie on 3/8 //
// Side Effects:Not much its only like b
// eginiing of C and C++ Programer
Click here to put this ticker on
//
your site! //This code is copyrighted and has// limited warranties.Please see http://
// www.Planet-Source-Code.com/vb/scripts/Sh
// owCode.asp?txtCodeId=3714&lngWId=3//for details.//**************************************
Daily Code Email //
To join the
'Code of #define ELEMENT 4
the Day'
Mailing List
#define LENGTH 20
click here! void getdata(char str[ELEMENT][LENGTH]);
void show(char str[ELEMENT][LENGTH]);
void sort(char str[ELEMENT][LENGTH]);
void main()

1 of 4 3/11/2010 2:06 AM
A simple strings sorting by Tahseen http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCode...

{
char str[ELEMENT][LENGTH];
cout<<"Find the sortin of string\n";
getdata(str);
sort(str);
show(str);
}

void getdata(char str[ELEMENT][LENGTH])

{
int loop;
for(loop=0;loop<ELEMENT;loop++)

{
cin.getline(str[loop],LENGTH);
}

void sort(char str[ELEMENT][LENGTH])

{
char temp[LENGTH];
int loop;
bool flag;
do

{
flag=false;
for(loop=0;loop<ELEMENT;loop++)

{
if(strcmp(str[loop],str[loop+1])>0)

{
flag=false;
strcpy(temp,str[loop]);
strcpy(str[loop],str[loop+1]);
strcpy(str[loop+1],temp);
flag=false;
}

}while(flag!=false);

void show(char str[ELEMENT][LENGTH])

{
int loop;
cout<<endl;
for(loop=0;loop<ELEMENT;loop++)

{
cout<<str[loop]<<endl;
}

Make extra programming $$$ on over a thousand open


projects like this one!

Title: Website - CMS, Shopping Cart, CRM


asp/asp.net(rep ost)
Max Bid: $900
Description:
Hi,<BR >We are looking for a website package
that incorporates<BR >Co re Elements:</
STRONG>CMS (content management
system), allowing the addition modification of
unlimited webpages.Sh opping Cart
(payments via paypal)News letter System<
STRONG>Bonus Elements:</STRO NG> (not
required but would be a bonus)Booki ng
Managment system(Integrat ed with
payment)CRM Resonse s/BID...

Or offload your extra work by posting your own project.

Other 2 submission(s) by this author

2 of 4 3/11/2010 2:06 AM
A simple strings sorting by Tahseen http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCode...

Report Bad Submission


Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote!

What do you think of this code(in the Beginner 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


5/29/2002 11:51:18 PM: Rush2Sun
if(strcmp(str[loop],str[loop+1])>0)
{
flag = true;
.
.
.
//flag = false;
}
(If this comment was disrespectful, please report it.)

5/31/2002 1:16:34 AM: Sarmen BB


dont people know the diff between C++ and C? this is a C++ coding here.

(If this comment was disrespectful, please report it.)

6/26/2003 8:20:46 AM:


q
(If this comment was disrespectful, please report it.)

7/25/2003 11:06:53 PM:


tnx
(If this comment was disrespectful, please report it.)

12/28/2003 1:05:46 PM: SAJIN SV


This is a good code..But As i dont know C++ could u plz convert this to C
(If this comment was disrespectful, please report it.)

11/13/2006 12:03:07 AM: corey


if you know c theres only a few things to make this a whole c program very simple
(If this comment was disrespectful, please report it.)

12/18/2006 1:23:38 AM: Dheeraj Mehrotra


Wonderful Logic. No comments. Keep the good work on.
(If this comment was disrespectful, please report it.)

2/26/2007 2:49:17 AM: venugopal


sir i have a degree .. and i collect u r most datastructures programs .it is good opportunity to all
Thank QQQQQQ Sir
(If this comment was disrespectful, please report it.)

5/27/2009 2:11:35 AM: Fattah


little bit confused with this code cause i've never used iostream.h. but i think i can get the general understanding of this code. good job Mr. Tahseen...
(If this comment was disrespectful, please report it.)

Source Code Review Tool


Source Code Reviews Without the Hassles.
Download Free Trial Now!
www.SmartBear.com/30_Day_Trial

C++ Programming
The latest & greatest in parallel computing. Visit
our expert blog!
www.drdobbs.com/Go-Parallel

Image resizing on the fly


Make high-quality image thumbnails with this
ASP/ASP.NET component.
www.aspjpeg.com

Add Your Feedback!

3 of 4 3/11/2010 2:06 AM
A simple strings sorting by Tahseen http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCode...

Note:Not only will your feedback be posted, but an email will be sent to the code's author from the email account
you registered on the site, so you can correspond directly.

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.

To post feedback, first please login.

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 | Games | Feedback | Customize | C/ C++ Home | Site Home | Other Sites | Open
Letter from Moderators | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997-2010 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.

4 of 4 3/11/2010 2:06 AM

Das könnte Ihnen auch gefallen