Access Millions of academic & study documents

Given the equation shown on the board, assuming all variables are dou

Content type
User Generated
Showing Page:
1/6
Given the equation shown on the board, assuming all
variables are doubles, create the equation in C++ code.
Write a complete fragment of code that given the integer
test-score to a letter grade, base on the following rules:
int score; char grade; if test-score ge 90 then grade = A if
90 > test-score ge 80 then grade = B if 80 > test-score ge
70 then grade = C if 70 > test-score ge 60 then grade = D
if 60 > test-score then grade = F Consider the array called
datum declared as int datum [N], write a code fragment
that will fill it with zeros (ie., all elements will be set to 0).
Use a for-loop to fill the array Use a do-while loop to fill
the array Use a while-loop to fill the array Write a
function named zero that accepts a integer array followed
by the size of the array, such that it will set all elements of
the array to zero; for example: int x[] = {23, 45, 6, 90, 44};
const int N = sizeof(N)/sizeof(int); compiler will figure out
N zero(x, N); now all of x\'s elements are set to zero Its
prototype must be: void zero(int [], int); Develop a function
called repCount, with the prototype: bool repCount(const
char * S, char *P); Functionally, it accepts two c-strings,
and it searches string S for the occurrence of the string,
P: if found at least once it will return true. Example:
char*acid = \"UTTAGUATGUUU\"; bool found; found =
repCount(acid, \"TAG\"); found will be TRUE found =
repCount(acid, \"TGA\"); found will be FALSE
Solution
1. in question 1,you didn\'t specify which equation you
want create in C++. pls provide the equation.

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/6
2.source code to display grade :
#include <iostream.h>
#include<conio.h>
void main()
{
int score;
char grade;
clrscr();
cout<<\"\ enter your score : \";
cin>>score;
if(score>=90)
cout<<\"\ Grade : A\";
else if(score>=80 && score<90)
cout<<\"\ Grade : B\";
else if(score>=70 && score<80)
cout<<\"\ Grade : C\";
else if(score>=60 && score<70)
cout<<\"\ Grade : D\";
else
cout<<\"\ Grade : F\";
getch();
return;
}
3. (a) source code to set elements to zero using for loop :
#include<iostream.h>

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/6

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 6 pages?
Access Now
Unformatted Attachment Preview
Given the equation shown on the board, assuming all variables are doubles, create the equation in C++ code. Write a complete fragment of code that given the integer test-score to a letter grade, base on the following rules: int score; char grade; if test-score ge 90 then grade = A if 90 > test-score ge 80 then grade = B if 80 > test -score ge 70 then grade = C if 70 > test-score ge 60 then grade = D if 60 > test-score then grade = F Consider the array called datum declared as int datum [N], write a code fragment that will fill it with zeros (ie., all elements will be set to 0). Use a for-loop to fill the array Use a do -while loop to fill the array Use a while-loop to fill the array Write a function named zero that accepts a integer array followed by the size of the array, such that it will set all elements of the array to zero; for example: int x[] = {23, 45, 6, 90, 44}; const int N = sizeof(N)/sizeof(int); compiler will figure out N zero(x, N); now all of x\'s elements are set to zero Its prototype must be: void zero(int [], int); Develop a function called repCount, with the prototype: bool repCount(const char * S, char *P); Functionally, it accepts two c -strings, and it searches string S for the occurrence of the string, P: if found at least once it will return true. Example: char*acid = \"UTTAGUATGUUU\"; bool found; found = repCount(acid, \"TAG\"); found will be TRUE found = repCount(acid, \"TGA\"); found will be FALSE Solution 1. in question 1,you didn\'t specify whic ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Indeed
4.5
Sitejabber
4.4

Similar Documents