PLEASE ANSWER ALL OF THEM, I REALLY APPRECIATE IT
PLEASE IGNORE THE SELECTED ANSWERS



Question 9:
Answer: Option 4 (last value is negative)
Explanation: When the loop exits the value of s must be true. For achieving this the last digit must be negative no matter what the remaining elements are.
Question 10:
Answer: Option 2 (7,3,0,8,8)
Explanation: the loop runs only upto the 3rd index(or 4th element) and replaces the current element by the next element. Hence the last element remains in its place unaltered.
Question 7:
Answer: Option 4 (the for loop tries to access an index that is out of the array's valid range)
Explnation: There are 5 elements in the array and the index can range from 0 to 4 but the loop runs untill 5 and element does not exist at index 5. Hence an error will be generated.
Question 8:
Answer: Option 3 (min value in v)
Explanation: The loop checks all the elements with the current min value and replaces the min value if any element is lesser than the current min. Hence s contains the minimum value present in v
Question 2:
Answer: Option 1 (MAX_SIZE / MAX_SIZE)
Explanation: The array must hold MAX_SIZE number of elements and hence XXX must be MAX_SIZE. The loop must run index from 0 to MAX_SIZE-1. But "<" runs the loop untill MAX_SIZE-1 only if YYY=MAX_SIZE.
Please give a like
PLEASE ANSWER ALL OF THEM, I REALLY APPRECIATE IT PLEASE IGNORE THE SELECTED ANSWERS Question 9...
Hi!, having trouble with this one, In this class we use visual studio, C++ language -------------------------------------------------------------- Exercise #10 Pointers - Complete the missing 5 portions of part1 (2 additions) and part2 (3 additions) Part 1 - Using Pointers int largeArray (const int [], int); int largePointer(const int * , int); void fillArray (int * , int howMany); void printArray (const char *,ostream &, const int *, int howMany); const int low = 50; const int high = 90; void main()...
I have to a C++ program I need help with. Can you break it into the two steps provided below. Suppose MAX_SIZE is a global constant int variable that has been declared and initialized to an appropriate positive value. 1. int maxValue(const array<int, MAX_SIZE>&, int); is the prototype for a function that returns the value of the largest element in the array parameter. The array may be only partially filled. The int parameter indicates how many items are actually in...
Please answer in C++, and Please consider
ALL parts of the question, especially where it
asks the user for V. So there should be a "cin
>> V" somewhere.
The last guy did not answer it correctly so please make sure you
do! Thank You!!
Question 1 Write the following two functions. The first function accepts as input a two-dimensional array of integers. It returns two results: the sum of the elements of the array and the average The second...
Who could write the array.cpp file ? //main.cpp #include "array.hpp" #include <iostream> int main() { int n; std::cin >> n; array a(n); for (int i = 0; i < n; i++) { std::cin >> a.data()[i]; } std::cout << "array size:" << a.max_size() << std::endl; std::cout << "array front:" << a.front() << std::endl; std::cout << "array back:" << a.back() << std::endl; int* data = a.data(); std::cout << "array elements using data:" << std::endl; for (int i = 0; i < n;...
may i ask for help with this c++ problem?
this is the code i have for assignment 4 question 2:
#include<iostream>
#include<string>
#include<sstream>
#include<stack>
using namespace std;
int main()
{
string inputStr;
stack <int> numberStack;
cout<<"Enter your expression::";
getline(cin,inputStr);
int len=inputStr.length();
stringstream inputStream(inputStr);
string word;
int val,num1,num2;
while (inputStream >> word)
{
//cout << word << endl;
if(word[0] != '+'&& word[0] != '-' && word[0] !=
'*')
{
val=stoi(word);
numberStack.push(val);
// cout<<"Val:"<<val<<endl;
}
else if(word[0]=='+')
{
num1=numberStack.top();
numberStack.pop();
num2=numberStack.top();
numberStack.pop();...
this is c code. please answer all questions on a piece of paper and
show work. i need to prepare as i have a midterm i will have to be
completing on paper
1) Bit Operators: This C program compiles and runs. What is its output? 1) #include <stdio.h> 2) void main (void) 3) unsigned char x =60; 4) 5) 6) 7) 8 ) 9) 10) 11) 12) 13) unsigned char a = x < 1; unsigned char b unsigned...
Here is the code I made, but the test case is not working, it
goes wrong when the binary string convert to decimal. please
help.
#include "stdafx.h"
#include <iostream>
#include <string>
#include <math.h>
#include <locale>
using namespace std;
// function for option 1
void decToBin(int number)
{
int array[16];
int i = 0;
for (int counter = 0;
counter < 16; counter++)
{
array[counter] = 0;
}
while (number > 0)
{...
Sometimes when I sit in restaurants waiting on food, I request the children’s menu to play the games. One of my favorites is the word puzzle in which you search for words hidden in a scramble of letters. I began to work out a solution to this game programmatically. That seemed a little simple, so I decided to have you solve the problem of a scramble of integers, finding the sub-row or sub-column which sums to another integer. You will...
Programming Assignment 7 Implement a function named fibo that will get a 20 element initialized an array of zeros from the main function. It will set the array to the Fibonacci sequence. This sequence starts with 1 and 2 as the first 2 elements and each element thereafter is the sum of the previous two elements. (1, 2, 3, 5, 8, 13…). Add another function named findNum that will get the newly created array by fibo from the main function....
Please, explain clearly each line of code with your answers. Question 1 Consider the following code snippet: int ctr = 0; int myarray[3]; for (int i = 0; i < 3; i++) { myarray[i] = ctr; ctr = ctr + i; } cout << myarray[2]; What is the output of the code snippet? Question 2 Consider the following code snippet: int cnt = 0; int numarray[2][3]; for (int i = 0; i < 3; i++) { for (int j =...