subject
Engineering, 07.03.2020 06:29 jfarley259

Write a for loop to determine the number of elements in vector userValuess that equal matchValue. Assign the number of matching elements to numMatches. Use NUM_VALS to determine how many elements are in the vector. Ex: numMatches is 3 if matchValue = 2 and userVals = {2, 2, 1, 2}.

Sample program:

#include
#include
using namespace std;

int main() {
const int NUM_VALS = 4;
vector userValues(NUM_VALS);
int i = 0;
int matchValue = 0;
int numMatches = 0;

userValues. at(0) = 2;
userValues. at(1) = 2;
userValues. at(2) = 1;
userValues. at(3) = 2;

matchValue = 2;

cout << "Elements equal to " << matchValue << ": " << numMatches << endl;

return 0;
}

ansver
Answers: 3

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Burgers vector is generally parallel to the dislocation line. a)-true b)-false
Answers: 2
question
Engineering, 04.07.2019 18:10
True or false (explain) (110)[111] is a slip system in bcc metals . the {111} family in fcc contains 8 planes. resolved shear stress (rss) in single crystals is just related to the applied stress. critical resolved shear stress (crss) in single crystal metals is direct proportional to the number of defects in the structure
Answers: 2
question
Engineering, 04.07.2019 18:10
Aturning operation is performed with following conditions: rake angle of 12°, a feed of 0.35 mm/rev, and a depth of cut of 1.1 mm. the work piece is aluminum alloy 6061 with t6 heat treatment (a16061-t6). the resultant chip thickness was measured to be 1.0 mm. estimate the cutting force, fc. use shear stress of 207 mpa and coefficient of friction on the tool face of 0.6.
Answers: 1
question
Engineering, 04.07.2019 18:20
Wiy doeres rere okhn a pump whon working betwon the same pressure range?
Answers: 2
You know the right answer?
Write a for loop to determine the number of elements in vector userValuess that equal matchValue. As...
Questions
question
Mathematics, 23.06.2019 04:31