Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Instructions:

  1. Declare and define display() function with the ff. details:
  2. Return type - void
  3. Name - display
  4. Parameters
  5. int* - an array
  6. int - the size of an array

Given code

#include <iostream>

using namespace std;


// TODO: Declare the display() function here



int main(void) {

  int world[100] = {

    1,3,2,4,5,7,6,8,9,11,

    100,13,0,14,16,17,3,18,20,10,

    12,8,15,14,-5,17,19,18,1,9,5,

    10,13,11,14,16,22,0,18,20,3,

    99,13,15,14,22,17,19,0,23,2,

    12,13,15,22,16,17,56,18,44,99,

    2,13,22,14,16,89,19,69,101,34,

    12,22,15,14,78,17,69,18,2,33,

    4,13,77,7,10,17,19,91,4,22,

    12,98,15,14,15,17,19,18,7

  };


  display(world, 100);

   

  return 0;

}


// TODO: Define the display() function here


Ex

Element·at·index·0:·1

Element·at·index·1:·3

Element·at·index·2:·2

Element·at·index·3:·4

.

.

.



Inst.

  1. Implement the findRing() function w/ the ff. details
  2. Return type int
  3. Name findRing
  4. Parameters
  5. int* - rings array
  6. int - array size of rings
  7. int - ring she wants
  8. Return value - the index of the ring in the array of rings.

Given code

#include <iostream>

using namespace std;

// TODO: Declare findRing()


int main(void) {

  int rings[10];


  for(int i = 0; i < 10; i++) {

    cout << "Enter option #" << i + 1 << ": ";

    cin >> rings[i];

  }


  int wantedRing;

  cout << "Enter the ring she wants: ";

  cin >> wantedRing;


  cout << endl << "Ring " << wantedRing << " is found at option " << findRing(rings, 10, wantedRing) + 1 << "!";


  return 0;

}


// TODO: Define findRing()


Ex

Enter option #1: 5

Enter option #2: 3

Enter option #3: 10

Enter option #4: 9

Enter option #5: 13

Enter option #6: 11

Enter option #7: 20

Enter option #8: 25

Enter ring she wants: 25


Ring·25 found·at·option·8


Write a program that calculates the area of a triangle.


Base class name=shape and variables are base,height(protected)


Derived class name=Triangle and member function that returns the formula of triangle.




Write a C++ program that declares an array list (a one-dimensional array) of 10 components of

type int. Initialize the array in a for loop by using rand() function with some random values

ranging from 0 to 250 and then display the components of array list horizontally by using another

for loop.

Take an integer as an input from user to be searched in the list by comparing the desired item with

each component of the array.

Program will display the index of component if searching is successful otherwise it should display an

appropriate message that “Searched item is not found!”.

Hint: Also include appropriate header files for predefined functions to be used.


create a c++ program with a function named display that displays 10 random words input by user using array. It should accept spaces and don’t accept numbers. If numbers were input it should say “INVALID INPUT”


Instructions:

  1. You are provided with an array that contains different characters.
  2. Ask the user for an integer input which represents the address.
  3. Then, print the element of the provided array using that integer as the index.

Given code:

#include <iostream>

#include <cstring>

using namespace std;


int main() {

  // NOTE: Do not edit this

  char location[100] = "CodeChumIsLoveAndProgrammingAsWellYey";

}


Example:

Enter the address: 1

Place at index 1 is o


Instructions:

  1. Ask the user for a string input
  2. From the string inputted, find the index of the capital letter.
  3. For this problem, it is guaranteed that there is only 1 capital letter in the inputted string.
  4. Hint: Use the isupper(char) function from the cctype library to check if a letter is capital or not.

Example:

Enter string: Philippines



Instructions:

  1. Check if the value of the char named myself is equal to one of the characters present in the string called others.
  2. Do this by comparing each of the characters in the string to myself.
  3. Print out only the index of the character which matches that of myself. If there are several matches, separate them by a single line.

Given code:

#include <iostream>

using namespace std;


int main() {

  // NOTE: Do not change this

  const char others[100] = "TheQuIckBrownFoxJumpedOvErTheLazyDog";

   

  char myself;


  // TODO: Ask the user for the value of `myself`

 

}

Sample input:

Enter myself: T


26


Gathering Positivity

by CodeChum Admin

I always want to look at the positive side of things, so I decide to seriously look at positive numbers, too!


Will you code along with me?



Instructions:

  1. Using the do…while() loop, continuously scan for random integers, but add up only all the positive integers and store the total in one variable.
  2. The loop shall only be terminated when the inputted integer is zero. Afterwards, print out the total of all inputted positive integers.

Input

Multiple lines containing an integer on each.

2
3
4
-1
-5
1
0

Output

A line containing an integer.

10




The outer if-else statement checks the type of day, and the nested if-else statements check the hour of travel.

True

False




LATEST TUTORIALS
APPROVED BY CLIENTS