program编程讲解、C/C++程序设计调试、c++程序辅导
- 首页 >> Java编程 Question 1.
Please write a program that display the following results.
Question 2.
Please write a program that prompts the user to enter the int number of students and each student’s score (Integer type, between [0 100]) , then system finally displays the highest score with the student number.
Question 3.
Please write a test program that reads a C-string and displays the number of letters in the string.
Question 4.
Design a class named Location for locating a maximal value and its location in a two-dimensional array. The class contains public data fields row, column=4, and maxValue that store the maximal value and its indices in a two dimensional array with row and column as int type and maxValue as double type. The class also contains a constructor Location(row, column, maxValue) for creating an instance with the specified row, column, and maxValue.
Write the following function that returns the location of the largest element in a two-dimensional array. Assume that the column size is fixed.
const int ROW_SIZE = 3;
const int COLUMN_SIZE = 4;
Location locateLargest(const double a[][COLUMN_SIZE]);
The return value is an instance of Location. Write a test program that prompts, that requires user to input data (double type) for the matrix row-by-row, and enter a 3 by 4 two-dimensional array and displays the location of the largest element in the array.
Question 5.
Please write a program to create a file named Data.txt if it does not exist under current path.
Write 50 integers, that are no greater than 500, created randomly into the file using text I/O. Integers are separated by spaces in the file.
Read the data back from the file and display the sorted data.
Please write a program that display the following results.
Question 2.
Please write a program that prompts the user to enter the int number of students and each student’s score (Integer type, between [0 100]) , then system finally displays the highest score with the student number.
Question 3.
Please write a test program that reads a C-string and displays the number of letters in the string.
Question 4.
Design a class named Location for locating a maximal value and its location in a two-dimensional array. The class contains public data fields row, column=4, and maxValue that store the maximal value and its indices in a two dimensional array with row and column as int type and maxValue as double type. The class also contains a constructor Location(row, column, maxValue) for creating an instance with the specified row, column, and maxValue.
Write the following function that returns the location of the largest element in a two-dimensional array. Assume that the column size is fixed.
const int ROW_SIZE = 3;
const int COLUMN_SIZE = 4;
Location locateLargest(const double a[][COLUMN_SIZE]);
The return value is an instance of Location. Write a test program that prompts, that requires user to input data (double type) for the matrix row-by-row, and enter a 3 by 4 two-dimensional array and displays the location of the largest element in the array.
Question 5.
Please write a program to create a file named Data.txt if it does not exist under current path.
Write 50 integers, that are no greater than 500, created randomly into the file using text I/O. Integers are separated by spaces in the file.
Read the data back from the file and display the sorted data.