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
Academic databases are the best place to look for
masha68 [24]
The definition of an academic database is a collection of information that is commonly used for research and writing, including access to academic journals. An example of an academic database is Academic Journals Answer is E
5 0
3 years ago
When you use your fingerprint on a reader attached to your computer to authenticate yourself as the legitimate computer user, wh
bogdanovich [222]
You're using biometric authentication, this is not limited to fingerprints though.

Biometric authentication can include, but is not limited to: retina scanners, voice recognition and facial recognition.
7 0
3 years ago
What should be entered to make the loop print
Scilla [17]

Answer:

x = x + <u>10</u>

Explanation:

since the difference between 60, 70 and 80 is 10, adding 10 to x will make the loop print.

7 0
3 years ago
Write about how this item was important to you.
nlexa [21]
What is important to you
7 0
2 years ago
A(n) ________ is an information system that works across national borders, facilitates communication between headquarters and su
Nostrana [21]

Answer: Global information system (GIS)

Explanation:

 The global information system is the process which basically works for the national borders and also facilitates the communication between the different countries and headquarters.

The GIS system is the information system that are used globally in the system. It is the global information system that deliver the data with the limited context at worldwide.

It basically incorporate all the technology and various application to store at the geographical boundaries and also manipulate the transmitted data.

5 0
3 years ago
Other questions:
  • Question 9.9. Encryption is BEST described as
    12·1 answer
  • A video game character prefers to take enemies on from a distance. What skills might such a character have?
    11·2 answers
  • Determine and prove whether an argument in English is valid or invalid. About Prove whether each argument is valid or invalid. F
    5·1 answer
  • Python: Write a program that asks the user how many Fibonnaci numbers to generate and then generates them.
    10·1 answer
  • Explain the role of the network layer and Internet protocol (IP) in order to make internetworking possible.
    8·1 answer
  • ROM is a volatile memory. true or false​
    11·1 answer
  • Write a program to print the area of a rectangle by creating a class named 'Area' having two methods. First method named as 'set
    6·1 answer
  • Please help me I need a help
    13·1 answer
  • The Freeze Panes feature would be most helpful for which situation?
    6·1 answer
  • Because it manages all other software the computer which software is most important
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!