1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Naddika [18.5K]
3 years ago
7

Write a function that will alphabetize a string WITHOUT using the sort function :

Computers and Technology
1 answer:
Dimas [21]3 years ago
7 0

Answer:

here is code in C++.

#include <bits/stdc++.h>

using namespace std;

// function to alphabetize the input string

void alphabetize(string &str)

{

// find the length of string

 int n=str.size();

 

  for(int x=0;x<n;x++){

      for(int y=x+1;y<n;y++)

      {  

          //swap the character

          if(str[x]>str[y]){

              char ch=str[x];

              str[x]=str[y];

              str[y]=ch;

          }

      }

  }

 

  cout<<"alphabetize string is: "<<str<<endl;;

 

}

int main()

{// string variable to read input

  string inp;

 

  cout<<"Please Enter a String in lowercase :";

  //reading the input

  cin>>inp;

  // call function with inp argument

  alphabetize(inp);

  return 0;

  }

Explanation:

Declare a variable "inp" of string type and assign the input string to it. call the alphabetize() function with argument "inp".In the alphabetize(),find the length  of input string.Then travers the string and if a character is greater than any  next character in the string then swap it, so that all the character are sorted.

Output:

Please Enter a String in lowercase :helloworld                                                                                                                

alphabetize string is: dehllloorw

You might be interested in
Lena is completing her senior year of college and is living in an apartment with three friends. Her family has a subscription to
vladimir1956 [14]

Answer:

d) consumer misbehavior

Explanation:

This is an example of consumer misbehavior. What Lena is doing is not technically piracy or illegal because HBO has created the family feature on their accounts for the account to be used by multiple people at the same time. Yet, the feature was not intended to be used by individuals that are not technically family or even under the same roof. Therefore, what Lena is doing goes against HBO's reason for this feature and sharing the account as Lena is doing is ultimately hurting HBO's streaming service.

4 0
3 years ago
What cell address indicates the intersection of the first row and the first column in a worksheet?
Roman55 [17]
The answer is A1. 

The columns are arranged alphabetically, and the rows are ordered numerically. The cell address states the column, a letter, followed by the row, a number. The first cell address, the top-left cell of the sheet, is A1
7 0
3 years ago
Read 2 more answers
Please Answer Quickly
leonid [27]

Answer:

graphic design and digital marketing solutions

3 0
3 years ago
Read 2 more answers
What keeps unauthorized internet users out of private intranets?
Kruka [31]
I think coders put in codes. Sry if that does not help.
8 0
3 years ago
1) differentiate between Tittle and caption
Yakvenalex [24]

Answer:

The difference and the steps to insert media in the project can be defined as follows:

Explanation:

Title:

The title is a document, that defines the object that is legally operated.  

Caption:

The Caption is also known as the title or the heading, which described the words on a screen, that conveys the message, that is being said.

Difference:

  • The titles will be assigned to the starting of the clip,  that selects, and charges will be applied to the project at the end.  
  • The caption may also be applied as a text to a specific clip for the reason.

Step to insert any media in the project:

  • Choose the preferred location to insert your media.  
  • Tap on the top of the insert Tab.      
  • Choose the desired media form.  
  • after selecting your desired media, click on the insert button, at this, the media will be inserted.
3 0
3 years ago
Other questions:
  • HELP ASAP????? please
    5·2 answers
  • Because log-on procedures may be cumbersome and tedious, users often store log-on sequences in their personal computers and invo
    6·1 answer
  • The ____ button resets slide placeholders to their default position, size, and text formatting.
    11·1 answer
  • One of the ways to create a horizontal navigation menu from an unordered list is to a. set the display property of the element w
    6·1 answer
  • Colin Mackay Inc., a software company with its head office in Amsterdam, has employees across three continents. The company's pr
    10·1 answer
  • a. Do you think the U.S. government should censor information on the Web, such as instructions for making weapons, to protect th
    12·1 answer
  • 11. What are the two DFS models?12.When you move a file from the Spreadsheets folder to the Corp Documents folder on a Windows S
    6·1 answer
  • Which button should be utilized if a user is unsure whether or not they are the right person to reply to an email?
    6·2 answers
  • Write any two merits and demerits of computer​
    8·1 answer
  • Once you fix the bug in a code, what is the last thing you should do?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!