Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 7.1, Problem 7STE
Program Plan Intro
Purpose of given code:
The purpose of given code is assigns the value into array using “for” loop.
Given code:
/*Include the header files*/
#include <iostream>
using namespace std;
//Main method
int main()
{
/*Declaration of variables*/
int sampleArray[10];
//Loop
for(int index=1;index<=10;index++)
/*Multiply the index value into 3 and store to array*/
sampleArray[index]=3*index;
}
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
int X[10]={2,0,6,11,4,5,9,11,-2,-1);
From the code above, what is the value of X[8] ?
What happens when the ref or out keyword is used with an array parameter?
Question 4: Write a code which copy elements of Array_1 in array_2 in reverse order?
For example:
Array_1
13
12
3
17
array_2
17
3
12
13
2.
Chapter 7 Solutions
Problem Solving with C++ (10th Edition)
Ch. 7.1 - Prob. 1STECh. 7.1 - In the array declaration double score(5); state...Ch. 7.1 - Identity any errors in the following array...Ch. 7.1 - What is the output of the following code? char...Ch. 7.1 - What is the output of the following code? double a...Ch. 7.1 - What is the output of the following code? int i,...Ch. 7.1 - Prob. 7STECh. 7.1 - Suppose we expect the elements of the array a to...Ch. 7.1 - Prob. 9STECh. 7.1 - Suppose you have the following array declaration...
Ch. 7.2 - Consider the following function definition: void...Ch. 7.2 - Prob. 12STECh. 7.2 - Write a function definition for a function called...Ch. 7.2 - Consider the following function definition: void...Ch. 7.2 - Insert const before any of the following array...Ch. 7.2 - Write a function named outOfOrder that takes as...Ch. 7.3 - Write a program that will read up to ten...Ch. 7.3 - Write a program that will read up to ten letters...Ch. 7.3 - Following is the declaration for an alternative...Ch. 7.4 - Prob. 20STECh. 7.4 - Write code that will fill the array a (declared...Ch. 7.4 - Prob. 22STECh. 7 - Write a function named firstLast2 that takes as...Ch. 7 - Write a function named countNum2s that takes as...Ch. 7 - Write a function named swapFrontBack that takes as...Ch. 7 - The following code creates a small phone book. An...Ch. 7 - There are three versions of this project. Version...Ch. 7 - Hexadecimal numerals are integers written in base...Ch. 7 - Solution to Programming Project 7.3 Write a...Ch. 7 - Prob. 4PPCh. 7 - Write a program that reads in a list of integers...Ch. 7 - Prob. 6PPCh. 7 - An array can be used to store large integers one...Ch. 7 - Write a program that will read a line of text and...Ch. 7 - Write a program to score five-card poker hands...Ch. 7 - Write a program that will allow two users to play...Ch. 7 - Write a program to assign passengers seats in an...Ch. 7 - Prob. 12PPCh. 7 - The mathematician John Horton Conway invented the...Ch. 7 - Redo (or do for the first time) Programming...Ch. 7 - Redo (or do for the first time) Programming...Ch. 7 - A common memory matching game played by young...Ch. 7 - Your swim school has two swimming instructors,...Ch. 7 - Your swim school has two swimming instructors,...Ch. 7 - Prob. 19PPCh. 7 - The Social Security Administration maintains an...
Knowledge Booster
Similar questions
- int A[3] [4]={{ 4, 6, 7, 9},{ 1, 3, 4, 3},{-5, 6, 7, 2}}; int sum, row, col; sum = 0; for (col=0;col<=3;i++) sum+=A[0] [col]; what is the value of sum calculated the number of elements on row 0 the total addition of elements on row 0 the total addition of first 3 elements on row 0 the total addition of all the elementsarrow_forwardWhat is the function of the following code?//code startconst size = 4;const ArrayOfSize = [];for (var i = 0; i < size; i++);{ArrayOfSize.push(i + 1);}ArrayOfSize;//code endarrow_forwardIf int abc[5]= {1,2,3,4,5}. What is the value of abc[4]?arrow_forward
- An array's index type may be any form of data. Do you think this is true or not?arrow_forwardWhat does each line of code mean?arrow_forwardConsider the following line of code: int[] somearray = new int[30]; Which one of the following options is a valid line of code for displaying the twenty-eighth element of somearray?arrow_forward
- $cars = array("Volvo", "BMW", "Toyota"); what is cars[0] O Volvo O Toyotaarrow_forwarddespite that the array parameter is preceded by the const qualifier, the array elements can be modified in the function body. Select one: True Falsearrow_forwarddef clipping_2d_array(array, threshold):"""Iterate through each element of the 2d array using nested loops.Set the values greater than a threshold value equal to the threshold value given as an input parameter.(E.g. if the threshold is 1 and there is a value 1.5, set the value to 1 in the array):param array: a 2d array:param threshold: a threshold value (valid int or float)"""passarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- New Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning