How to execute this using vector
#include <cmath>
#include <iostream>
const short int SIZE = 10;
double mean(const double x[], int size);
// Compute the deviation of double values
double deviation(const double x[], int size);
int main() {
double myarray[SIZE];
std::cout << "Enter the number: ";
for (int index = 0; index < SIZE; index++)
std::cin >> myarray[index];
std::cout << "The mean is " << mean(myarray, SIZE) << ".\n";
std::cout << "The standard deviation is " << deviation(myarray, SIZE)
<< ".\n";
return 0;
}
double mean(const double x[], int size) {
double total = 0;
for (int index = 0; index < size; index++)
total += x[index];
return total / size;
}
double deviation(const double x[], int size) {
double themean = mean(x, size);
double total = 0;
for (int index = 0; index < size; index++) {
total += pow(x[index] - themean, 2);
}
return sqrt(total / size - 1);
}
How to execute this using vector
#include <cstdlib>
#include <ctime>
#include <iostream>
int main() {
int dice[6] = {0};
srand(time(0));
for (int ctr = 0; ctr < 10000; ctr++) {
switch ((rand() % 6) + 1) {
case 1:
dice[0] += 1;
break;
case 2:
dice[1] += 1;
break;
case 3:
dice[2] += 1;
break;
case 4:
dice[3] += 1;
break;
case 5:
dice[4] += 1;
break;
case 6:
dice[5] += 1;
break;
}
}
for (int index = 0; index < 6; index++)
std::cout << index + 1 << " appears " << dice[index] << " time/s\n";
return 0;
}
How to execute this using vector
#include <iostream>
bool doesexists(int array[], int toseaarch, int size);
const short int SIZE = 10;
int main() {
int myarray[SIZE], distinct_ctr = 0, index = 0;
std::cout << "Enter 10 numbers: ";
for (index = 0; index < SIZE; index++) {
int tmp;
std::cin >> tmp;
if (!doesexists(myarray, tmp, SIZE)) {
myarray[distinct_ctr] = tmp;
distinct_ctr++;
}
}
std::cout << "distinct numbers are: ";
for (index = 0; index < distinct_ctr; index++)
std::cout << myarray[index] << " ";
std::cout << "\n";
return 0;
}
bool doesexists(int array[], int toseaarch, int size) {
for (int index = 0; index < size; index++) {
if (toseaarch == array[index])
return true;
}
return false;
}
9. Write short notes on:
a) Electronic mail
b) voice over IP
c) HTTP
d) FTP
10. find the class of each address.
a) 00000001 00001011 00001011 11101111
b) 11000001 10000011 00011011 11111111
c) 14.23.120.8
d) 252.5.15.111
8. a) what are the difference between classful addressing and classless addressing in IPv4?
b) what are the difference between routing and forwarding?
c) compare unicast and multicast routing protocols.
7. a) compare the TCP header and the UDP header. List the fields India the TCP header that are not present in UDP header. Give the reason for their absence.
b) what is cognation? Explain any one of the cognation control mechanism.
6. a) what is the difference between a port address,a logical address,and a physical address?
b) compare OSI model and TCP/IP protocol suit.
In a particular factory, the team leader is an hourly paid production worker that leads a small team. In addition to hourly pay, team leaders earn a fixed monthly bonus. Team leaders are required to attend a minimum number of hours of training per year. Design a TeamLeader class that extends the Production Worker Class. The LeamLeader class should have fields for the monthly bonus amount, the required number of training hours, and the number of training hours that the team leader has attended. Write one or more constructors and the appropriate accessor and mutator methods for the class. Demo the class by using a program that uses the TeamLeader object.
Write the array implemention of binary search tree.
Write the following functions :
1)insert
2)delete
3)search
4)display
Note:
No global declarations
Test run in main