Question

In: Computer Science

Fill-In-The-Blanks 13. Complete the code by filling in the blanks for each question below. (Length of...

Fill-In-The-Blanks 13. Complete the code by filling in the blanks for each question below. (Length of blank doesn’t matter.)

a) Print out the contents of the array airlines. #include #include ________________ using namespace std; int main () { string airlines[] = {"american","pan-am","southwest"}; for (int i = 0;_______________;i++) cout << ____________ << endl; return 0; }

b) Read in 5 integers from the user and write them back out in reverse order int numbers[5]; for(int i = 0; ___________; _________) cin >> numbers[i]; for(int i = 4; ___________; _________) cout << numbers[i] << endl;

c) Sets a pointer and outputs the dereferenced value. int x = 5; int *xPtr; // xPtr "points to" x xPtr = _____________; cout << ___________ << endl;  

Solutions

Expert Solution

Please read comments for your understaning ...
==============================================

/*
* Print out the contents of the array airlines. #include
* #include ________________ using namespace std; int main ()
* { string airlines[] = {"american","pan-am","southwest"};
* for (int i = 0;_______________;i++) cout << ____________ << endl; return 0;
* }

b) Read in 5 integers from the user and
write them back out in reverse order int numbers[5];
for(int i = 0; ___________; _________) cin >> numbers[i];
for(int i = 4; ___________; _________) cout << numbers[i] << endl;

c) Sets a pointer and outputs the dereferenced value.
int x = 5; int *xPtr; // xPtr "points to" x xPtr = _____________; cout << ___________ << endl;
*/

#include <iostream> //Header that defines the standard input/output stream objects
using namespace std;
int main() {
   //===========================================================//
   //Q1.
   //===========================================================//
   string airlines[] = { "american", "pan-am", "southwest" };
   for (int i = 0; i<sizeof(airlines)/sizeof(string); i++) //sizeof(airlines)/sizeof(string) gets the size of airlines
       cout << airlines[i] << endl; //accessing the elements of array one by one
   //===========================================================//

   //===========================================================//
   //Q2.
   //===========================================================//
   int numbers[5];
   //Here loop will repeat i=0,1,2,3,4 and fails at i<5 when i = 5 so finally we will get five elements in out integer array
   for(int i = 0; i<5; i++) cin >> numbers[i];
   //Here loop will repeat i=4 ,3,2,1,0 and fails in condition check i>=0 here you keep your eye on = symbol at condition check[i<=4]
   //if = not there it will take only 4 elemets not 5 as we required
   for(int i = 4; i>=0; i--) cout << numbers[i] << endl;
   //===========================================================//

   //===========================================================//
   //Q3.
   //===========================================================//

   int x = 5; int *xPtr; // xPtr "points to" x
   xPtr = &x;
   cout <<"Dereferenced value :"<< *xPtr << endl;
   //===========================================================//

   return 0;
}

==================================


Related Solutions

Fill in the blanks in the MATLAB code below.
Fill in the blanks in the MATLAB code below. (Do not type unnecessary words or blank spaces in your response. The correct answers are case-sensitive.) % Consider a row vector v. % Complete the lines of code below to find the average and standard deviation of the elements of vector v such that these two values are assigned to variables M and S, respectively. E = G =
JAVA CODE FILL IN THE BLANKS you are to complete the skeleton program by completing *...
JAVA CODE FILL IN THE BLANKS you are to complete the skeleton program by completing * the To Do sections. I would suggest doing this a * little bit at a time and testing each step before you * go on to the next step. * *           Add whatever code is necessary to complete this assignment *********************************************************************/ //Add whatever code is necessary to complete this assignment public class Methods {    public static void main(String[] args)    {...
Fill in the blanks in the paragraph below to complete a description of mutants and mutations...
Fill in the blanks in the paragraph below to complete a description of mutants and mutations In DNA, a Blank 1 mutation can result from the expected sequence CCG being coded instead as CTG. As a result of this change, the resulting m-RNA codon would be GAC instead of Blank 2. Consequently, this will result in an amino acid of Blank 3 instead of Blank 4. Since the amino acids are Blank 5, the mutation can definitely be ruled out...
The following partial information is available. Complete the table by filling in all the blanks. Each...
The following partial information is available. Complete the table by filling in all the blanks. Each case is independent. Variable Fixed Total Operating Contribution Case Revenues Costs Costs Costs Income Margin Percentage a. $4,000 _ $500 _ $1,460 _ % b. _ 7,400 _ 8,700 9,800 _ % c. 10,600 _ 3,200 _ _ 30 % d. 9,450 _ 2,500 8,170 _ _ % ​(Round the contribution margin percentage to the nearest whole percent. Use parentheses or a minus sign...
Fill in the blanks to complete the following table.
Fill in the blanks to complete the following table.SymbolIon FormedNumber of Electrons in IonNumber of Protons in IonF__________9Te_____54_____II−_______________Mg2+_____12Part AComplete the first column of the table.Express your answer as a chemical symbol.Part BComplete the second column of the table.Express your answer as ions. Enter your answers in order given in the table, from top to bottom, separated by a comma.Part CComplete the third column of the table.Express your answer as integers. Enter your answers in order given in the table, from...
Fill in all the remaining blanks in the table below and fill out the appropriate formula each.
Fill in all the remaining blanks in the table below and fill out the appropriate formula each.Residual maturityResidual MaturityInterest rate of Zero coupon bondPrice of Zero Coupon Bondone-year intrinsic forward interest ratepar yield18.00%27.00%36.00%
Fill in the blanks in each of the following statements
Fill in the blanks in each of the following statementsa) --------- allows you to build JavaFx GUIS using drag and drop techniques.b) The elements in the scene graph are called --------------c) A(n) ----------- file contains the description of a JavaFX GUI.d) The method ---------------- is called by FMXLLoader before the GUI is displayed
For each of the questions that follow, fill in the blanks. Blanks are denoted by --[N.]--,...
For each of the questions that follow, fill in the blanks. Blanks are denoted by --[N.]--, where N is an upper-case Roman numeral. (a) Complete the following code so that the loop executes 10 times (3) int j = −−[I.]−−; int i=1; while ( −−[II.]−− ) { i = i + −−[III.]−−; } (b) Complete the following function which sorts C-strings into alphabetic order. (4) Page 4 void bubbleSort( char names[ ][COLS] , int count) { int pass , index...
Download and complete this assignment by answering the questions or filling in the blanks! Week 3...
Download and complete this assignment by answering the questions or filling in the blanks! Week 3 Assignment.docx Write out what each abbreviation stands for: OTC FDA APhA DEA CSA USP PDR USP/NF LASA SR GI USAN CPOE PAD List and describe three different names by which a drug may be referred. ­­­­­­_______________________________________ ______________________________________ ______________________________________ Describe the following terms and which health care professionals can perform the tasks listed. Prescribe Administer Dispense Physicians Nurse practioners and Physician Assistants Medical Assistants Describe...
Complete the following statements by filling in the blanks. The bolded words in between the slashes...
Complete the following statements by filling in the blanks. The bolded words in between the slashes are options. One will be correct. The bolded $ ???? are supposed to be filled in with a numerical value please show word, i have a test coming up and im very confused! a. In a period in which a taxable temporary difference reverses, the reversal will cause taxable income to be less than / greater than pretax financial income. b. If a $74,900...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT