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
Examples in types of experimental methods <br>​
Elodia [21]

Lab Experiment

Field Experiment

Natural Experiment.

3 0
3 years ago
Read 2 more answers
which type of group found in server 2008 is used to provide access to resources for all users and guests​
evablogger [386]

Answer:

Everyone

Explanation:

There are various types of groups found on the server 2008, and everyone is one out of them. Here we are required to provide them access to the resources to all the users as well as the guests. And hence, we need to provide all the access to the resources. Thus, the correct option here is certainly everyone, which is an option available in the server 2008.

5 0
3 years ago
I’m failing this class and i’m stuck on this one, this is the code from the last lesson:
serg [7]

lst=([])

def avgGPA(lst1):

   total = 0

   count = 0

   for x in lst:

       if type(x) == int:

           total += x

           count += 1

   return total/count

def GPAcalc(grade, weighted):

   grade = grade.lower()

   dictionary = {"a": 4, "b": 3, "c": 2, "d": 1, "f": 0}

   if weighted == 1 and grade in dictionary:

       lst.append(dictionary[grade]+1)

       return "Your GPA score is: " + str(dictionary[grade] + 1)

   elif weighted == 0 and grade in dictionary:

       lst.append(dictionary[grade])

       return "Your GPA score is: " + str(dictionary[grade])

   else:

       lst.append("Invalid")

       return "Invalid"

classes = int(input("How many Classes are you taking? "))

i = 0

while i < classes:

   print(GPAcalc(input("Enter your Letter Grade: "), int(input("Is it weighted? (1 = yes) "))))

   i += 1

print("Your weighted GPA is a "+str(avgGPA(lst)))

If you need me to change any code, I'll do my best. I hope this helps!

6 0
3 years ago
Robyn needs to ensure that a command she frequently uses is added to the Quick Access toolbar. This command is
Brrunno [24]

Answer:

Option A

Explanation:

In case if Robyn is unable to find the frequently used command, then Robyn can use the back stage view to check for the command as the orientation setting allows to access more settings

Hence, option A is correct

4 0
3 years ago
Consider the following code:
garri49 [273]

I got you bro the answer is 50, 15, 5

6 0
2 years ago
Other questions:
  • Apple Final Cut Pro is a digital video editing program that is available for Macs with OS X version 10.4 or later.
    7·2 answers
  • What is the most effect way to include space after each paragraph
    14·1 answer
  • The benefits associated with AAA are increased security, increased control over the network, and the capability of auditing your
    12·1 answer
  • What does PHP stand for?
    9·2 answers
  • What characters cannot be used in a filename?
    15·1 answer
  • CIST 1122 Project 2 Instructions
    11·1 answer
  • Effective nonverbal communication can cause tension.<br><br> True or False
    15·1 answer
  • You want to copy data from one cell or range to an adjacent cell or range in your spreadsheet, without using a shortcut key. Whi
    10·1 answer
  • What is 30 x 30 x 30 x 30
    14·2 answers
  • How many different four-letter combinations for a locker password can you make with the lowercase and uppercase forms of the fir
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!