Reference no: EM13167086
Explain the difference between public data members and private data members. Give an example in the main function to show that one C++ statement is valid and the other is invalid (you can use Grade class in Problem 5.
2 What output would be produced by the following program?
#include <iostream>
using std::cout; using std::endl;
int main()
{
int a[] = {3, 1, 0, 2, 4};
int b[] = {50, 40, 30, 20, 10};
for (int i=0; i<5; i++}
cout << b[ a[i] ] << endl;
return 0;
}
3 The following code has many errors. Please point out and correct them.
#include <iostream>
using namespace std;
class Date
{
public
Date()
{
month = day = 0;
}
setDate(int m, int d)
{
month = m;
day = d;
}
int getDay();
{
return day
}
private
int month, day;
}
int main()
{
Date d;
setDate(10,20);
cout << getDay() << endl;
return 0;
}
4 What output would be produced by the following program?
.........................
int main()
{
ifstream fin;
fin.open("list.dat");
int count = 0;
double next, total=0.0;
cout << fixed << setprecision(2);
while (fin >> next)
{
count++;
total += next;
cout << setw(7) << next << endl;
}
fin.close();
cout << "The sum of " << count << " numbers is "
<< total << endl;
return 0;
}
The file list.dat contains the following five numbers (and nothing more):
10.0001 1.1e2 1.0e-6
5.0007 -5.0008
Write a program in which a ball is released
: Write a program in which a ball is released from a user-defined height and free-falls to the ground. The ball is pulled by earth's gravity of 9.8 m/sec 2 . Assume that each pixel represents 1 cm. Once the ball hits the ground
|
For each of these four modifications
: For each of these four modifications, compute and graph the effects on the original system. Explain in words the effect when the multiprogramming level, N , is small and when N is large.
|
C program to mips program
: Convert the following C program to MIPS program. Assuming that i, j, k, f, are stored in registers $s0, $s1, $s2, $s3 already.
|
Python program that reads in a series of positive integers
: Write a Python program that reads in a series of positive integers and writes out theproduct of all the integers less than 25 and the sum of all the integers greater than or equal to 25. Use 0 as a sentinel value
|
Public data members and private data members.
: Explain the difference between public data members and private data members. Give an example in the main function to show that one C++ statement is valid and the other is invalid (you can use Grade class in Problem 5.
|
The goal of this project is to create
: The goal of this project is to create a simple command line program that reads in a single word from the command line (use the "int argc, char * argv[]" approach discussed in class and in previous projects) and stores the unique letters of that wo..
|
Write a program that reads an array with wind-tunnel test
: write a program that reads an array with wind-tunnel test data then allowss the user to enter a flight-path angle. If the angle is within the bounds of the data set, the program should then use linear inteerpolation to compute the corresponding coeff..
|
Generate a two-dimensional array
: Generate a two-dimensional array of integers of 10 rows by 10 columns that contains 100 random numbers between 0 and 9. Print out the array (well formatted) and do the following computations
|
End to end encryption
: How is end to end encryption different from other types of encryption? At what layer does it take place?
|