64 693
Assignments Done
99,3%
Successfully Done
In September 2018

Answer to Question #4518 in C++ for David Obot Umoekah

Question #4518
Write a program, that after the input of a resistance-value, by means of a while{}, checks if this value exists
in the E12 range (10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82 and decimal powers until 8,2 Mohm)
Use an array to store this E12 range.
Expert's answer
#include <iostream.h>
main(){
int R[12];
R[0] = 10;
R[1] = 12;
R[2] = 15;
R[3] = 18;
R[4] = 22;
R[5] = 27;
R[6] = 33;
R[7] = 39;
R[8] = 47;
R[9] = 56;
R[10] = 68;
R[11] = 82;
bool E12=false;
int dec=1;
int i;
cout<<"Enter resistance value:\n";
cin>>res;
while ((E12==false)&&(dec<=82000000)){
& for (i=0;i<=11;i++){
if (res==R[i]*dec) E12=true;
}
& dec=dec*10;
& }
if (E12==true) cout<<"Resistance exists in the E12 range.\n";
if (E12==false) cout<<"Resistance doesn't exist in the E12 range.\n";
}

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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions