Reference no: EM131211386
Computer Programming
Objectives:
1. Opening a file, reading from file, writing to a file and closing a file.
2. Sequential access files handling.
3. Practice C++ programming problems.
Note: Carefully read the following instructions (Each instruction contains a weightage)
1. There must be a block of comments at start of every question's code by students; the block should contain brief description about functionality of code.
2. Proper indentation of code is essential
3. Write a C++ statement(s) for each of the following task one after the other, in the same order.
4. Make a Microsoft Word file and past all of your C++ code with screenshot of outputs in MS word.
5. First think about statement problems and then write/draw your logic on copy.
6. After copy pencil work, code the problem statement on MS Studio C++ compiler.
7. At the end when you done your today lab tasks , attached all created C++ files+ MS word file and make your submission on slate.
PROBLEM 1.
A class instructor found that the class he is teaching have a habit of not doing assignments by themselves. He looked into all the previous assignment submissions and found a very interesting pattern that, the students take assignment only from their neighbor roll no’s. and submit it as it is but the tricky part is that odd roll no’s only copy it from their odd neighbors and even roll no’s copy it only from their even neighbors. E.g. if a student has roll no. 23, the possibility is that he/she can copy the assignment from roll no 21 or 25 as they are the odd neighbor of roll no 23. Similarly even neighbors of roll no. 2 are 0 and 4.
The instructor evaluates the assignments and assigns marks as floating point values. The instructor knows that if 2 students have submitted the same assignment they will get same marks. So the instructor quickly wants to find out how many students are involved in copy-case and what are their roll no’s. Unfortunately the instructor doesn’t know the programming and needs your help. The instructor will provide you the data in below format.
First line of input contains an integer N where N should be greater than 0 and less than 100, denoting the number of students. Then following N space separated floating point values in next line representing each student’s marks in assignment. You can assume that the student roll no’s start from 0 and the student’s assignment marks is input and it is sorted roll no wise. So first entry of marks is off roll no. 0 and the last entry will have roll # (N-1).
You are to read assignment marks of all the students and store them in an array and the indexes of the array would represent roll no’s.
Now your task is to find out how many students are involved in copy case and what are their roll no’s. Your program should find this based on the criteria of odd and even neighbors that instructor mentioned above. The example below will give you the complete idea.
Example:
Input:
8
3.5 9.4 13.42 9.4 45.56 45.56 45.56 3.5
Array mapping:
Your array should look like this:
Array Index (Roll NO’s)
|
0
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
Assignment Marks
|
3.5
|
9.4
|
13.42
|
9.4
|
45.56
|
45.56
|
45.56
|
3.5
|
Output:
Count of students involved in copy case: 4
Roll no’s of students involved: 1, 3, 4, and 6
PROBLEM 2.
Write a C++ program to sort an array of 10 elements by bubble sort algorithm. First you have to initialize array with random numbers less than 15 then you will sort it in ascending order.
Linear beam element in abaqus
: ENCOR4050 Modelling and Simulation in Engineering Project - Compare the quality of 3-node triangular, 6-node triangular, 4-node quadrilateral and 8-node quadrilateral elements - Linear beam element in Abaqus
|
Assignment for behs parenting today
: You are a famous child development expert with specialties in the topics we've just covered in Weeks #1-4. You have been contacted by Parenting Magazine to write a research-based article on one of the following controversial parenting practices:
|
Explain how cell elongation occurs
: Draw arrows from longitudinal figure to cross section matching each tissue to correct primary meristem.
|
Is there an element of surprise or the unexpected
: Is there an element of surprise or the unexpected? What technique was used? Is the process apparent? Can you associate it with an artistic style or idea (classical nonrepresentational, abstract, surrealistic, etc.)?
|
Computer programming
: Opening a file, reading from file, writing to a file and closing a file. Sequential access files handling. Practice C++ programming problems.
|
How might the precautionary principle apply to this study
: What other recent studies can you find that either contradict or support these findings? Do the other studies impact your assessment of the significance and interpretation of this study? How? Be sure to provide the full citation for the other stud..
|
Would you like to sell any of the properties
: Would you like to sell any of the properties? If so which one and why? Currently the appraisal on the condo is $135,000 and the house is $70,800. What about raising the rent on the properties?
|
Design and develop a web site for the bsit program
: Purpose: To design and develop a web site for the BSIT program offered by the MSIS Department of College of Management, UMass Boston to promote this program to potential students
|
Did the author forget to include other information
: Were there information in the article that you did not know prior to the article? What were those information? What else was missing from the paper? Did the author forget to include other information?
|