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
Whitepunk [10]
3 years ago
15

The following program declares an array of char named as myString There are 6 following cases (a, b, c, d, e, f) to access myStr

ing. Which cases are valid access? If there are any invalid cases, how to correct them? #include using namespace std; int main() { char myString[16]; //a. strcpy_s(myString, "Hello the world"); //b. cout << strlen(myString); //c. myString = "Mary Lane"; //d. cin.getline(myString, 80); //e. cout << myString; //f. myString[6] = 't'; return 0;
Computers and Technology
1 answer:
yuradex [85]3 years ago
3 0

Answer:

See explaination

Explanation:

a.

myString is "Hello the world"

b.

prints "15"

c.

This is invalid.

We have to use strcpy_s to copy strings

FIX:

strcpy_s(s,"Marylane");

d.

reading string upto length 80 from the user and stored it in myString variable

e.

prints the string enetered by user to console

f.

replacing 7th character by 't'

You might be interested in
What line of code makes the character pointer studentPointer point to the character variable userStudent?char userStudent = 'S';
Zielflug [23.3K]

Answer:

char* studentPointer = &userStudent;

Explanation:

Pointers in C are variables used to point to the location of another variable. To declare pointer, the data type must be specified (same as the variable it is pointing to), followed by an asterisk and then the name of the pointer. The reference of the target variable is also assigned to the pointer to allow direct changes from the pointer variable.

3 0
3 years ago
Write a program thattakes a number x and its exponent y from the user and thencalculate the result
miv72 [106K]

Answer:

#include<iostream>

using namespace std;

//main function program start from here

int main(){

   //initialize the variables

  int num, exponent;

   int result=1;

   //print the message on the screen

  cout<<"Please enter the number: ";

  cin>>num;  //store the user enter value

  cout<<"Please enter the exponent: "; //print the message on the screen

  cin>>exponent;//store the user enter value

   //take a while loop for calculating th power.

  while(exponent != 0){

   result = result*num;

  exponent--;

  }

  cout<<"Result is: "<<result<<endl;

}

Explanation:

Create the main function and declare the variable.

Then, display the message on the screen for the user and store the value enter by the user in the variables by using the instruction cin.

Take a while loop and it run until the value of exponent not equal to zero.

and then repeated multiply the number with the previous value which stores in the result.

for example;

the number is 2 and the exponent is 3. Initially, the result store is 1.

then, result = 1 * 2=2

exponent--, then exponent update the value 2.

again loop executes,

result = 2* 2=4

exponent--, then exponent update the value 1.

again loop executes,

result = 4* 2=8

exponent--, then exponent update the value 0.

The same process happens in our code and it run until the exponent not equal to zero. when it reaches zero, the loop will be terminated.

and finally, print the output.

4 0
4 years ago
A group of two or more computer systems linked together via communication devices is called:.
ioda

A group of two or more computer systems linked together via communication devices is called: A Network

5 0
3 years ago
What type of malicious software tries to gather information about you without your consent?
AlekseyPX

Answer:

B-malware

Explanation:

I do tech and i help work on computars.

6 0
3 years ago
The effects of activating the complement system include all of the following except
Bezzdna [24]

Effect of Activating the complement system

Inhibition of the immune response is not an effect of Activating the complement system

Explanation:

The effects of activating the complement system include destruction of target cell plasma membranes and stimulation of inflammation.  Inhibition of the immune response is not an effect of activating the complement system. Opsonization and Chemotaxis are also known effect of activating the complement system. Opsonization is  an immune process where bacteria are targeted for destruction by an immune cell called as phagocyte . Chemotaxis is movement of the cells in response to a chemical stimulus. Chemotaxis is the cell movement toward a gradient of increasing chemical concentration

6 0
3 years ago
Other questions:
  • OSHA has authority over the employers of
    5·2 answers
  • Additional rows and columns are inserted into a table by using the _____ tab
    7·2 answers
  • Which type of peripheral is a keyboard?
    11·2 answers
  • What engine component is shown in the above Figure?
    14·2 answers
  • which of the following information technology career fields generally requires the lowest level of education for an entry level
    9·1 answer
  • What is out put.what is data. what is microprocessor
    14·1 answer
  • What are the draw backs of the third generation computer​
    13·1 answer
  • According the SDLC phases, which among these activities see a substantial amount of automation initiatives?
    12·2 answers
  • Given a MxN matrix.Print the elements in odd rows from left to right and the elements in even rows from right to left.(Java or C
    11·1 answer
  • What is the term of illegal copy of software?​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!