ascending and descending orders of letters

how can i make a ascending and descending order of a input word using

Page 1 of 1

7 Replies - 11119 Views - Last Post: 27 January 2010 - 02:36 AM Rate Topic: -----

#1 Perpendikulo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 16-March 09

ascending and descending orders of letters

Post icon  Posted 22 March 2009 - 11:43 PM

#include<iostream.h>
#include<stdlib.h>
void main()
{

	
	 
	char *letters[26]={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","Y","Z"};

	int x,y,z;
	char choice,word;

	cout<<"This program will form your the letters of the\n";  //problem
	cout<<"words` in ASCENDING and DESCENDING form.\n";
	cout<<endl;


	cout<<"OPTION:";								//option									
	cout<<endl;
	cout<<"A.Ascending\n";
	cout<<"B.Descending\n";
	cout<<endl;		

	cout<<"Choose your choice:";					//choice		
	cin>>choice;									
	
	
	system("pause");
	system("cls");
	
	
	
	
	
	if(choice == 'a' || choice == 'A')				//ascending			
		{
			cout<<"Enter word : ";
			cin>>word;
			cout<<"sorted word(ascending):";
		
			for(x=0;x<=26;x++)
			{
				if(word == *letters[26])
				{
					cout<<letters[x];
			
				}
			}
					
					
					
					
				
			
		}
	
	
}
	


Is This A Good Question/Topic? 0
  • +

Replies To: ascending and descending orders of letters

#2 JackOfAllTrades  Icon User is online

  • Saucy!
  • member icon

Reputation: 5954
  • View blog
  • Posts: 23,218
  • Joined: 23-August 08

Re: ascending and descending orders of letters

Posted 23 March 2009 - 04:51 AM

Please restate your question, and the problems you may be having, in the body of your message.
Was This Post Helpful? 0
  • +
  • -

#3 Perpendikulo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 16-March 09

Re: ascending and descending orders of letters

Posted 23 March 2009 - 11:52 PM

[quote]
ok!! :^:
[/quote
Was This Post Helpful? 0
  • +
  • -

#4 smith2009  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 20-March 09

Re: ascending and descending orders of letters

Posted 24 March 2009 - 02:53 AM

Hi,

That's good Program.

Can you write another program from which we can entering a String and convert it in to lower case or upper case ?
I need that

:)

_____________________________
Smith
Beginner in ColdFusion Development.
Was This Post Helpful? 0
  • +
  • -

#5 VenumX  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 21-February 09

Re: ascending and descending orders of letters

Posted 24 March 2009 - 07:36 AM

you may want to look into getting the dec value of the character in the array and using it in a bubble sort algorithm. if you're not familiar with bubble sort its basically an algorithm that will switch around the items in the array until no swaps are needed. im sure you could find example code either on this site by searching or on google.
Was This Post Helpful? 0
  • +
  • -

#6 mischief6  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 21
  • Joined: 09-January 09

Re: ascending and descending orders of letters

Posted 24 March 2009 - 08:06 AM

you could do this pretty easily with the sort function in the algorithm header.
Was This Post Helpful? 0
  • +
  • -

#7 slones  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 27-January 10

Re: ascending and descending orders of letters

Posted 27 January 2010 - 02:22 AM

View PostPerpendikulo, on 22 Mar, 2009 - 10:43 PM, said:

#include<iostream.h>
#include<stdlib.h>
void main()
{

	
	 
	char *letters[26]={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","Y","Z"};

	int x,y,z;
	char choice,word;

	cout<<"This program will form your the letters of the\n";  //problem
	cout<<"words` in ASCENDING and DESCENDING form.\n";
	cout<<endl;


	cout<<"OPTION:";								//option									
	cout<<endl;
	cout<<"A.Ascending\n";
	cout<<"B.Descending\n";
	cout<<endl;		

	cout<<"Choose your choice:";					//choice		
	cin>>choice;									
	
	
	system("pause");
	system("cls");
	
	
	
	
	
	if(choice == 'a' || choice == 'A')				//ascending			
		{
			cout<<"Enter word : ";
			cin>>word;
			cout<<"sorted word(ascending):";
		
			for(x=0;x<=26;x++)
			{
				if(word == *letters[26])
				{
					cout<<letters[x];
			
				}
			}
					
					
					
					
				
			
		}
	
	
}
	

Was This Post Helpful? 0
  • +
  • -

#8 suresh.chereddy@gmail.com  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 57
  • Joined: 06-February 08

Re: ascending and descending orders of letters

Posted 27 January 2010 - 02:36 AM

you were not specifying the function definition...please check it out
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1