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
vfiekz [6]
2 years ago
5

Implement one array of the English alphabet (26 characters). a) Create a function, getLetters() to cast and generate the array.

b) Create a function, printLetters() to output the array. c) Create a function, swap() for swapping character variables. d) Create a function, reverseLetters() uses a loop and the swap() to reverse all array elements. e) Call printLetters()to Output the updated array. Hint: Set a variable for the first and last indices. Swap those values. Gradually move the first/last pointers to the middle of the array, swapping as you go. When the middle is reached, the array will be reversed.
Computers and Technology
1 answer:
WARRIOR [948]2 years ago
6 0

#include <fstream>

#include <iostream>

#include <iomanip>

#include <cstring>

#include <cstdlib>

using namespace std;

// Function Declarations

void display(char alphabets[],int MAX_SIZE);

void reverse(char alphabets[],int MAX_SIZE);

void swap(char &ch1,char &ch2);

int main() {

 //Declaring constant

const int MAX_SIZE=26;

 

//Declaring a char array

char alphabets[MAX_SIZE];

 

//Populating the array with alphabets

for(int i=0;i<MAX_SIZE;i++)

{

 alphabets[i]=(char)(65+i);

 }

 

 cout<<"Original: ";

 display(alphabets,MAX_SIZE);

 reverse(alphabets,MAX_SIZE);

 cout<<"Reversed: ";

 display(alphabets,MAX_SIZE);

 return 0;

}

//This function will display the array contents

void display(char alphabets[],int MAX_SIZE)

{

 for(int i=0;i<MAX_SIZE;i++)

 {

    cout<<alphabets[i]<<" ";

 }

 cout<<endl;

}

//This function will reverse the array elements

void reverse(char alphabets[],int MAX_SIZE)

{

 int first,last;

 first=0;

 last=MAX_SIZE-1;

 

 while(first<last)

 {

   

    swap(alphabets[first],alphabets[last]);

    first++;

    last--;

   

 }

}

void swap(char &ch1,char &ch2)

{

 char temp;

 temp=ch1;

 ch1=ch2;

 ch2=temp;

You might be interested in
Use the drop-down tool to match each definition to the correct word or phrase. The computer that responds to requests from the c
Lera25 [3.4K]

Answer:

The computer that responds to requests from the client computer:  

Server

Connects network devices or different parts of a network:  

Switch

A piece of equipment that directs data where it should go:  

Router

Connects many different Ethernet devices and allows them to connect to the network with one connection:  

Hub

The computer that uses service provided by a server:  

Client

Explanation:

6 0
3 years ago
Identify congruent triangles. Justify why these triangles are congruent?
dem82 [27]
4 because it’s a triangular ruler
3 0
3 years ago
Which ics function records time accounting and procures needed items?
vladimir1956 [14]
It is the finance / administration function that records time accounting and procures the needed items
7 0
3 years ago
A company has determined that its annual profit is typically 51 percent of total sales.
const2013 [10]
Congratulations to the company!

5 0
3 years ago
Help me!!!!! This is the last question! HELP ME! I REPEAT: HELP ME!!!! I AM SO IN NEED!!!
Liono4ka [1.6K]

Answers:

1. JavaScript is a very well-known computer dynamic language.

2. 09/55

3. Option C

JavaScript is the most popular computer dynamic language.

It was invented in the September of 1955.

The option best describing it is the most popular dynamic computing language.

Hope this answer helps you!

5 0
3 years ago
Read 2 more answers
Other questions:
  • Which two editions of Windows 7 support 64 bit CPUs? Choose two out of Professional, Business, Starter, or Home Premium.
    12·1 answer
  • A device that makes it possible for multiple customers to share one address is called a/n _____.
    8·1 answer
  • How can you logout your account and do not want to have this anymore
    12·2 answers
  • Which of the following is something that scientists often seek by using computer models and simulations?
    8·2 answers
  • PLEASE HELP
    15·2 answers
  • The optional feature in a business letter is
    10·1 answer
  • Which database item would show details such as a customer’s name, their last purchase, and other details about a customer?
    11·2 answers
  • A popular database software program called ____ offers a wizard and QBE tool to help build and generate SQL queries
    9·1 answer
  • Define each of the following data mining functionalities: characterization, discrimination, association and correlation analysis
    9·1 answer
  • _____ provides the best video resolution. *<br><br> VGA<br> HDMI<br> USB<br> DVI
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!