Write a program that reads a given set of integers and then prints the number of odd
and even integers. It also outputs the number lof zeros.
Sample output: (The user input is bolded)
Please enter 20 integers, positive, negative, or zeros.
0 0 -2 -3 -5 6 7 8 0 3 0 -23 -8 0 2 9 0 12 67 54
hembers you entered arer
7 8030-2990 29 0 12 67 54
There are 13 evens, which includes 6 zeros.
The number of odd numbers is 7.
1 What is an array?
.2 Identify the different types of array.
3 Create a simple cpp program that uses array.
challenge.h
#include <stdio.h>
float foo(float F);
float bar(float F);
main.c
#include "challenge.h"
float a = 8.5;
int main() {
float fa = foo(a);
float ba = bar(a);
printf(“%.1f\n”, fa + ba);
return 0;
}
challenge.c
#include "challenge.h"
extern float a;
float foo(float F) {
a = 7.3;
return F * a
}
challenge2.c
#include "challenge.h"
extern float a;
float bar(float F) {
a = 7.5;
float ff = foo(F);
return ff * a;
}
Given the source code above and we use "gcc main.c challenge.c challenge2.c -o challenge" to compile it. What's the output when we type ./challenge
I ask you question thank you for your response but it's main class only
Draw a flowchart and develop an application that will store the salesperson’s code, which is to be entered in the codeTextBox, in an Integer variable named code. The application will need to store the sales amount, which is to be entered in the salesTextBox, in a decimal variable named sales. Display the result of the calculation, or the error message, in the messageLabel. Name your Program SalesAccount.
Also provide a picture of the program's design
We wish to compute the definite integral I = Z 1 0 1 1 + √x dx numerically and compare to the exact result, Iexact = 2 − log 4. (a) Use the composite trapezium rule Z b a f(x)dx ' X N i=0 wifi, wi = ( Δx/2, i = 0 or i = N Δx 1 ≤ i ≤ N − 1 , Δx = b − a N , to compute the integral I, using N + 1 = 64 equidistant points in x ∈ [0, 1]. Use three instances of a vector to store the values of the gridpoints xi, function values fi = f(xi) and weights wi. [Hint: you may use the function from Question 2a to compute the dot product of the vectors wi and fi.] Output to the screen (and list in your report) your numerical result Itrapezium and the difference Itrapezium − Iexact.
What is the output of following function, if called as foo( rr,0,6) ? arr content as follows: a-b-c- d-e-f
void foo(char arr[], int i, int s)
{
if(i>=s) return ;
cout<< arr[i];
if * (i + 1 < s)
foo(arr, i+2,s) ;
cout<<arr [ i]; }
Select one :
a. a c e a c e
b. a c e e c a
c. a c b e e a
d. a d f f d a
What is the output of following function, if called as fun * (array, 0, 6) array content as follows: 1-2-3-4-5-6 ?
void fun(int array[], int index, int size)
{
if(index >=size)
return;
cout<< array[index];
if(index+1< size)
fun(array , index + 2 ,size);
cout << array[index];
Select one:
a 132551
b. 135531
c.135135
d. 146
Which is the correct syntax for returning an object by pointer ?
Select one :
a. ClassName * functionName (){ }
b.*class object functionName () { }
c. void function Name (){ }
d. object& functionName() { }
Write a program that demonstrate the use of constructor with default
arguments for the following problem. Define a class Person with data member as name
and age. Create three objects with no argument, one argument name and two argument
name and age. You are not allowed to create more than one constructor.