Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++: Fill in the following blanks (1-8): 1. A string type variable is defined as

ID: 3663218 • Letter: C

Question

C++:

Fill in the following blanks (1-8):

1. A string type variable is defined as string address: please write the statement used to receive a sequence of characters input from keyboard and save them in the variable address ONOTE: the string may contain spaces) (Fill in the blank with the function name) All C++ program runs from the function 3. If we need to use vectors, what header file should we include? 4. Variable x is defined as int type, please complete the expression to test if x is an even number 5. If we want to resize vector A by removing the last element, which function should we call? 6. We assume: string first serena", last- "Williams", ini; ini first substr(0, 1)+ last substr(0, l); What's the value of variable ini? Assume: int year, cin year, user year, what's the value ofthe following expression? inputs 1900 for year%4 0 && year %100 0 year%400 0 Loops can be implemented in three ways: do.. while, and for

Explanation / Answer

1Ans)

  #include <stdio.h>
void main()
{
char string[20];
int n, count = 0;
printf("Enter the no of characters present in an array ");
scanf("%d", &n);
printf(" Enter the string of %d characters " , n);
scanf("%s", string);
while (count < n)
{
printf(" %c = %d ", string [count], string[count] );
++ count ;
}
}

2Ans)

public static void main()

3Ans)

      #include<vector>

4Ans)

  int x=2;

if(x/2==0)

{

cout("x is even number");

}

5Ans)

  pop_back();

6Ans)   

ini=sewi

7Ans)

   out put is 1(true)

8Ans)

while loop:

Do loop:

do

For loop;   

for ( init; condition; increment )

  

  

  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote