answer.
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
Ymorist [56]
2 years ago
6

Replace any alphabetic character with '_' in 2-character string passCode. Ex: If passCode is "9a", output is: 9_

Computers and Technology
1 answer:
oksian1 [2.3K]2 years ago
4 0

Answer:

if(isalpha(passCode[0]))

{

passCode[0] = '_';

}

if(isalpha(passCode[1]))

{

passCode[1] = '_';  

}

         

Explanation:

The first if statement uses isalpha() function which checks if the character passed in this function is an alphabet. If the character stored in 0-th position (which is the first position whose index is 0) of the variable passCode is an alphabet then it is replaced with the '_'

The next if statement checks if the second character in the passCode variable is an alphabet. This means the function isalpha() checks if the character stored in second position (index 1) of the variable passCode is an alphabet then it is replaced with the '_'

The  complete activity with this chunk of code added and the output is attached in a screen shot.

You might be interested in
Pls help!! which of the following is not a step required to view a web page?
Fofino [41]
The first one! It’s not required to view web pages
3 0
2 years ago
Using Amdahl’s Law, calculate the speedup gain of an application that has a 60 percent parallel component for (a) two processing
Nina [5.8K]

Answer:

a) Speedup gain is 1.428 times.

b) Speedup gain is 1.81 times.

Explanation:

in order to calculate the speedup again of an application that has a 60 percent parallel component using Anklahls Law is speedup which state that:

t=\frac{1 }{(S + (1- S)/N) }

Where S is the portion of the application that must be performed serially, and N is the number of processing cores.

(a) For N = 2 processing cores, and a 60%, then S = 40% or 0.4

Thus, the speedup is:

t = \frac{1}{(0.4 + (1-0.4)/2)} =1428671

Speedup gain is 1.428 times.

(b) For N = 4 processing cores and a 60%, then S = 40% or 0.4

Thus, the speedup is:

t=\frac{1}{(0.4 + (1-0.4)/4)} = 1.8181

Speedup gain is 1.81 times.

8 0
2 years ago
At age 16, Cheyenne just got her driver's license. She loves to drive and is thinking of becoming a truck driver, because she he
Ivenika [448]
<span> the answer would be: Does she have or can she develop the strengths needed for this type of work?</span><span />
6 0
2 years ago
Read 2 more answers
EVERYONE LISTEN!!!! PLEASE COPY THIS MESSAGE AND RESEND!!!!
slavikrds [6]
Ok we will do it for you cause they are very mean
4 0
2 years ago
Read 2 more answers
Write a program that prompts the user to enter 50 integers and stores them in an array. The program then determines and outputs
Marrrta [24]

Answer:

Here is code in C++.

#include <bits/stdc++.h>

using namespace std;

int main()

{  

int n=50;

   // integer array to store 50 integers

   int arr[n];

   cout << "Enter 50 integers: ";

   //read 50 integers into array

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

       cin >> arr[i];

   cout << endl;

   

   //sort the array

   sort(arr,arr+n);

   

   // find all the pairs which give sum equal to any element of the array

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

   {

       cout<<"pair which give sum equal to  ";

       cout << arr[i] <<" is :";

       for (int j = 0; j < n; j++)

           for (int k = j + 1; k < n; k++)

               if (arr[i] == arr[j] + arr[k])

                   cout <<"("<<arr[j]<<" & "<< arr[k] <<")"<<",";

       cout << endl;

       cout << "*******************************" << endl;;

   }

   return 0;

}

Explanation:

Read 50 integers into an array from user.Sort the array in ascending order.Travers the sorted array and find all pairs which give sum of equal to any element of the array.Then print all such pairs.

Output:

Enter 50 integers: 23 30 34 1 3 4 9 12 96 92 80 84 123 54 67 87 34 55 21 38 29 111 10 44 103 47 83 72 77 88 80 56 49 5 102 166 134 200 205 188 178 133 154 148 162 191 193 207 209 44                                                                                                                                                                    

 pair which give sum equal to  1 is :                                                *******************************

pair which give sum equal to  3 is :                                                     *******************************    

pair which give sum equal to  4 is :(1 & 3),                                         ******************************    

pair which give sum equal to  5 is :(1 & 4),                                         ******************************    

pair which give sum equal to  9 is :(4 & 5),                                         *******************************  

pair which give sum equal to  10 is :(1 & 9),                                       *******************************  

pair which give sum equal to  12 is :(3 & 9),                                       *******************************  

pair which give sum equal to  21 is :(9 & 12),                                      *******************************  

pair which give sum equal to  23 is :                                                    *******************************    

pair which give sum equal to  29 is :                                                    *******************************    

pair which give sum equal to  30 is :(1 & 29),(9 & 21),                        *******************************  

pair which give sum equal to  34 is :(4 & 30),(5 & 29),                     *******************************    

pair which give sum equal to  34 is :(4 & 30),(5 & 29),                     *******************************    

pair which give sum equal to  38 is :(4 & 34),(4 & 34),(9 & 29),  

.

.

.

.

  

5 0
2 years ago
Other questions:
  • While researching ideas for cutting energy costs is his company. Hector watches an online video in which a business expert says,
    6·2 answers
  • Give a recursive (or non-recursive) algorithm to compute the product of two positive integers, m and n, using only addition and
    8·1 answer
  • c++ Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". Any value that is the same as the immediately preceding value is c
    14·2 answers
  • What three requirements are defined by the protocols used in network communications to allow message transmission across a netwo
    11·1 answer
  • 1. PGP encryption can be performed from the command line as well. What is the PGP command line syntax to encrypt the my-message.
    7·1 answer
  • Write the definition of a function power_to, which receives two parameters. The first is a float and the second is an integer. T
    5·1 answer
  • A blood bank maintains two tables - DONOR, with information about people who are willing to donate blood and ACCEPTOR, with info
    10·1 answer
  • Which of the following best describes the protocols used on the Internet?
    12·1 answer
  • For a custom App uploaded to Microsoft Teams, if an organization wants to disallow users from updating the settings of the custo
    12·1 answer
  • The microprogram counter (MPC) contains the address of the next microcode statement for the Mic1 emulator to execute. The MPC va
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!