Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

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.

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M91967384
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in C/C++

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As