Write a program that defines five integer variables and initializes them to I. 10, 100, 1000, and 10000 and prints them on a single line separated by spaces.
#include <iostream>
using namespace std;
int *my_array;
int array_length;
void FunA(int pos, int input){
my_array[pos] = input;
}
int FunB(){
int n;
cout<<"enter lenth of the array: ";
cin>>n;
my_array = new int[n] ;
return n;
}
int main (){
array_length = FunB();
FunA(array_length-1,20);
delete [] my_array;
return 0;
}
a) Explain the code snippet above in details.
write a pseudo code for a program which generates even numbers between 1000 and 2000 and then prints them in the standard output.it should also print total sum.
Question No.1 Implement this program by using User-defined functions and Structures.
Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type studentType, which has four components: studentFName and studentLName of type string, testScore of type int (testScore is between 0 and 100), and grade of type char. Suppose that the class has 20 students. Use an array of 20 components of type studentType. Your program must contain at least the following functions:
1. A function to read the students’ data into the array.
2. A function to assign the relevant grade to each student.
3. A function to find the highest test score.
4. A function to print the names of the students having the highest test score.
Design, write and compile a C++ program to display the following output using setw(), setprecision(), setiosflags():
Radians
Degrees
1
57.2958
10
572.9580
20
1145.9200
30
1718.87000
40
2291.83000
(b) What is the minimum number of cout statements that could be used to print the above output?
(c) Explain your choice of coding style with your chosen number of cout statements.
make a c ++ program ethat calculate the sum ,mean of series numbers
Create a class called Rectangle with data members: width, length and area. The class should have functions to allow for setting of both length and width, calculate the area, and retrieve the width, length and area.
Write a program to calculate the value of f(x) if u r given that f(x) =x+1, x<1
3x^2-x, x>1
10-x, x=1
What happens if the condition in a while loop is initially false? Explain and differentiate
between while and do while statement in ‘C’ language.