<u>Answer:</u>
I am writing <em>partial code in</em> <em>c++ to calculate weighted average</em>. The weighted average should be calculated based on multiplying the test score and its <em>respective weight and finally add all the test score.</em>
<u>Explanation:</u>
<em>int arrtestscore[100];</em>
<em>int arrweight[100];</em>
<em>int n;</em>
<em>double weightedavg;</em>
<em>cout<<”Enter the number of test score for which weighted average needs to be calculated”;</em>
<em>cin>>n;</em>
<em>for(int x = 0; x <n;x++)</em>
<em>{</em>
<em> cout<<”Enter test score :” + (x+1) ;</em>
<em> cin>>arrtestscore[x];</em>
<em> count<<”Enter the respective weight:”;</em>
<em> cin>>arrweight[x];</em>
<em>}</em>
<em>for (int i=0; i<n;i++)</em>
<em>{</em>
<em> weightedavg = weightedavg + (arrtestscore[i] * arrweight[i])</em>
<em>}</em>
<em>cout<<”weighted average = “ <<weightedavg; </em>
Answer:
Following are the program in C++ language
#include <iostream> // header file
using namespace std; // namespace
int main() // main function
{
int number=0; // variable declaration
while(number>-1) // iterating the while loop
{
cout<<"body"<<endl; // dsiplay the statement
cin>>number; // Read the value by the user
}
cout<<endl<<"Done";// dsiplay the statement
return 0;
}
Output:
body
5
body
45
body
-8
Done
Explanation:
Following are the description of the statement
- Declared a variable "number" of int type and initialized with 0 to them
- iterating the while loop. In this loop print the message "body" and Read the value by the user in the "number" variable. This loop will be executed repeatedly until the user do not read the negative value.
- After the execution of the while loop, it prints the message "Done".
The advantage of inserting the page number field is that the page number field could show the current page number.
The following information should be relevant with respect to the page number:
- The page number field & the actual page number should be formatted.
- The page number field & the actual page number both could be inserted into the header or footer.
- The page number field & the actual page number could be easily inserted into the document.
Therefore we can conclude that the advantage of inserting the page number field is that the page number field could show the current page number.
Learn more about the page number here: brainly.com/question/3063419
The hard disk drive, OR HDD Stores all the information on the computer.