Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use a sentinel-controlled loop to complete #4 on p.228. To test your code, the u

ID: 3908626 • Letter: U

Question

Use a sentinel-controlled loop to complete #4 on p.228. To test your code, the user must enter each surface height values given at the top of p. 229. You only need to calculate R f your program is working correctly, you should get the following value Arithmetic mean value of roughness, Ra 2.48 In C, to get the absolute value of a double x, type fabst Use this basic code to help you start and write your complete code below: #include #include #define SENTINEL 999.9 int main(void) 3. double input, sum-0.0, count 0.0, Ra; 4. Write a do-while loop that repeatedly prompts for and takes input until a value in the range o through 15 inclusive is input. You only need to write the code for the do-while loop below. are done, If you used a for loop for questions 2 and 3, try writing your code as a while logo. Or if you used a while loop, try writing your code as a for loop. This question is for your own 5. When you

Explanation / Answer


3.
#include<iostream>
#define SENTINAL 999.0
using namespace std;
int main()
{
double input,count=0.0,sum=0.0,Ra;
while(count<SENTINAL)
{
cout<<" Please Enter the Surface Height:"<<endl;
cin>>input;
sum=sum+input;
count++;
}
Ra=sum/count;
cout<<" Arithementic Mean Value of Roughness is:"<<Ra<<endl;
return 0;
}
4.
#include<iostream>
using namespace std;
int main()
{
int data,count=0;
do
{
cout<<" Please Enter the Data:"<<endl;
cin>>data;
count++;
}while((count<15)&&(data>=0&&data<=15));
return 0;
}

5.
#include<iostream>
#define SENTINAL 999.0
using namespace std;
int main()
{
double input,count=0.0,sum=0.0,Ra;
for(count;count<SENTINAL;count++)
{
cout<<" Please Enter the Surface Height:"<<endl;
cin>>input;
sum=sum+input;
}
Ra=sum/count;
cout<<" Arithementic Mean Value of Roughness is:"<<Ra<<endl;
return 0;
}