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]
1 year 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]1 year 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
पुजवय<br>शब्दस्य<br>विरूदायक​
statuscvo [17]

Answer:

के?

Explanation:

5 0
3 years ago
What is the main role of LDAP?
NISA [10]

Answer:

Run directory services

Explanation:

LDAP (Lightweight Directory Access Protocol) is an open protocol used to access some information, information that is stored in a network, the information is organized hierarchical structure, we could find some data like names, directories, and telephone numbers.

With other options, we can find DHCP to assign IP addresses and to resolve IP addresses to host names, we have the DNS.

7 0
3 years ago
Why a management-focused program provides a more appropriate learning path for you than a program based heavily on technical con
AlekseyPX
The program makes more money
3 0
3 years ago
This loop is a good choice when you know how many times you want the loop to iterate in advance of entering the loop.1. do-while
Luba_88 [7]

Answer:

Option 3 is the correct answer.

Explanation:

  • In c, c++ or Java programming language, The for loop takes three parameters in which first is an initialization, second is condition check and the third is an increment. None of the other loop (except for loop) takes three parameters. The other loop takes only one parameter and that is the condition check.
  • So when a user knows about the times of iteration then it is a good choice to use the for loop but when the person does not know about the times of iteration if the loop. It means the iteration of the loop is based on the condition then it is a good choice to chose while or Do-while loop.
  • The above question wants to ask which loop for a user can best if he familiar with the iteration of the loop then the answer is for loop which is started from option 3. Hence Option 3 is the correct answer while the other is not because--
  1. Option 1 states about the do-while loop which takes condition only.
  2. Option 2 states about the while loop which also takes condition only.
  3. Option 4 states about the infinite loop which is not any loop.
  4. Option 5 states about none of these which is not correct because option 3 is the correct answer.

6 0
3 years ago
An audit trail is a record of how a transaction was handled from input through processing and output
Nostrana [21]

The answer is : True.  An audit trail is a record of how a transaction was handled from input through processing and output.  An audit trail is the evidence, such as purchase orders and invoices, that a financial transaction actually occurred.

6 0
3 years ago
Other questions:
  • In a case where electrical current leakage from the circuit occurs,
    7·2 answers
  • In what decade did the Internet begin to be used widely by the public and not just government entities?
    5·2 answers
  • What does "Forward" in emails do?​
    7·1 answer
  • The company currently runs 60 autonomous APs and has plans to increase wireless density by 50% in the near future
    13·1 answer
  • I stole you pokemon cards :o
    6·2 answers
  • Which elements are in the Sort dialog box? Check all that apply.
    9·1 answer
  • Brainly is brainly am I correct ​
    11·2 answers
  • Who is tim berners-lee
    14·2 answers
  • Netiquette is the
    13·1 answer
  • A(n) Blank______ database management system allows users to create, read, update, and delete data in a relational database. Mult
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!