Answer:
The program to this question as follows:
Program:
#include<iostream> //include header file.
using namespace std; //using name space.
int main() //main function.
{
int n,i,key; //define variable.
int a[n]; //define array
cout<<"Enter size of array :"; //message.
cin>>n; //input number from user.
cout<<"Enter array elements :"; //message
for(i = 0;i<n;i++) //loop
{
cin>>a[i]; //input array elements
}
cout<<"Enter a number:"; //message
cin>>key; //input number.
for(i = 0;i<n;i++) //loop
{
if(a[i]<=key) //if block
{
cout<<a[i]<<"\n "; //print array elements
}
}
return 0;
}
Output:
Enter size of array :7
Enter array elements :5
50
50
75
100
200
140
Enter a number:100
5
50
50
75
100
Explanation:
The description of the above program as follows:
- In this program first, we include a header file and define the main method in method we define variables and array that are "n, i, key and a[]". In this function, all variable data type is "integer".
- The variable n is used for the size of array and variable i use in the loop and the key variable is used for comparing array elements. Then we use an array that is "a[]" in the array, we use the for loop to insert elements form user input.
- Then we define a loop that uses a conditional statement in if block we check that array elements is less than and equal to a key variable. If this value is true so, we will print the remaining elements.
I think the correct answer would be that it facilitates the transport of data. It is a very useful tool in the transport and storage of data. XML, also, uses human language rather than computer language so it can be used easily by new users.
The elements in a string type array will be initialized to "Null".
Answer:
The solution is written using Python as it has a simple syntax.
- def getHighScores(gameScores, minScore):
- meetsThreshold = []
- for score in gameScores:
- if(score > minScore):
- meetsThreshold.append(score)
- return meetsThreshold
- gameScores = [2, 5, 7, 6, 1, 9, 1]
- minScore = 5
- highScores = getHighScores(gameScores, minScore)
- print(highScores)
Explanation:
Line 1-8
- Create a function and name it as <em>getHighScores</em> which accepts two values, <em>gameScores</em> and <em>minScore</em>. (Line 1)
- Create an empty list/array and assign it to variable <em>meetsThreshold</em>. (Line 2)
- Create a for loop to iterate through each of the score in the <em>gameScores</em> (Line 4)
- Set a condition if the current score is bigger than the <em>minScore</em>, add the score into the <em>meetsThreshold</em> list (Line 5-6)
- Return <em>meetsThreshold</em> list as the output
Line 11-12
- create a random list of <em>gameScores</em> (Line 11)
- Set the minimum score to 5 (Line 12)
Line 13-14
- Call the function <em>getHighScores()</em> and pass the<em> gameScores</em> and <em>minScore </em>as the arguments. The codes within the function <em>getHighScores()</em> will run and return the <em>meetsThreshold </em>list and assign it to <em>highScores.</em> (Line 13)
- Display <em>highScores</em> using built-in function print().
A business plan and a <u>financial plan</u> to show the both his plan to make money, and how much money he will make, spend, use.