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

Illustrate the use of pointers in swapping two numbers.

Write 2 swap functions, for swapping two integers.

void swap(int,int);

void swap(int*,int*);


1.     Write a C++ statement that updates the value of newNum variable by adding the value of the named variable SECRET (assign any value to this variable). Then, write a C++ statement that outputs the value of newNum with an appropriate message.


1. Anagrams!

by CodeChum Admin

Two strings are called anagrams, if they contain the same characters, but the order of the characters may be different.


Given a string consisting of lowercase letters and question marks, s1, and another string consisting of lowercase letters, s2, determine whether these two strings could become anagrams by replacing each ? character in s1 with a letter.


Input


1. First string


Constraints

Contains only lowercase letters and/or question marks

2. Second string


Constraints

Contains only lowercase letters

Output


The first line will contain a message prompt to input the first string.

The second line will contain a message prompt to input the second string.

The last line contains the message "anagram" if the strings could become anagrams by replacing all the ? characters of s1 with letters and "false" otherwise.


TotalValue (value ), value2) //returns total of the 2 values

Write a function using C+* statements called Toto/P/oduction) which takes five integer artay's (amay), arrayz

array3, array4, arrayS) and an integer as the size of the arroyd as parameters. The arrayi to array4 Hold

quantity of the four (4) outlets over A days The funstion cakulates the total of each day using the

Tota/Value (value 1, value2) function and store in the array


Create a program that will Ask a user to enter a number. If the number is between 0 and 4, write the word blue. If the number is between 5 and 10, write the word red. if the number is between 11 and 14, write the word green. If it is any other number, write that it is not a correct color option.if else statement

Write a C# program that enters 5 elements to an array. Display all the odd numbers and even numbers separately.


Create a program that will Ask a user to enter a number. If the number is between 0 and 4, write the word blue. If the number is between 5 and 10, write the word red. if the number is between 11 and 14, write the word green. If it is any other number, write that it is not a correct color option.If else statement in C++

Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles.


Ex: If the input is:


-10 20 30 40


the output is:

Min miles: -10
Max miles: 40


#include <iostream>

using namespace std;


int main() {

  const int NUM_ROWS = 2;

  const int NUM_COLS = 2;

  int milesTracker[NUM_ROWS][NUM_COLS];

  int i;

  int j;

  int maxMiles = 0; // Assign with first element in milesTracker before loop

  int minMiles = 0; // Assign with first element in milesTracker before loop

  int value;


  for (i = 0; i < NUM_ROWS; i++){

   for (j = 0; j < NUM_COLS; j++){

     cin >> value;

     milesTracker[i][j] = value;

   }

  }


  /* Your solution goes here */


  cout << "Min miles: " << minMiles << endl;

  cout << "Max miles: " << maxMiles << endl;


  return 0;

}


Write a function SwapArrayEnds() that swaps the first and last elements of the function's array parameter. Ex: sortArray = {10, 20, 30, 40} becomes {40, 20, 30, 10}.


#include <iostream>

using namespace std;


/* Your solution goes here */


int main() {

  const int SORT_ARR_SIZE = 4;

  int sortArray[SORT_ARR_SIZE];

  int i;

  int userNum;


  for (i = 0; i < SORT_ARR_SIZE; ++i) {

   cin >> userNum;

   sortArray[i] = userNum;

  }


  SwapArrayEnds(sortArray, SORT_ARR_SIZE);


  for (i = 0; i < SORT_ARR_SIZE; ++i) {

   cout << sortArray[i] << " ";

  }

  cout << endl;


  return 0;

}


Type the output for the given program when the input is

1

7

10

9

6


#include <iostream>

using namespace std;


int FindScore(const int scoreVals[], int numVals) {

int i;

int returnVal = scoreVals[0];


for (i = 1; i < numVals; ++i) {

if (scoreVals[i] < returnVal) {

returnVal = scoreVals[i];

}

}


return returnVal;

}


int main() {

const int NUM_SCORES = 5;

int quizScores[NUM_SCORES];

int i;

int returnScore;


for (i = 0; i < NUM_SCORES; ++i) {

cin >> quizScores[i];

}


returnScore = FindScore(quizScores, NUM_SCORES);

cout << returnScore << endl;


return 0;

}


LATEST TUTORIALS
APPROVED BY CLIENTS