Questions: 9 913

Answers by our Experts: 9 913

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

An election is contested by five candidates. The candidates are numbered 1 to 5 and a voting is done by marking the candidate number in a ballot paper. Write a C++ program to read the ballot and count the votes cast for each candidate using an array variable count. In case, a number read is outside the range 1 to 5 the ballot should be considered as a 'spoilt ballot', and the program should also count the number of spoilt ballots

An election is contested by five candidates. The candidates are numbered 1 to 5 and a voting is done by marking the candidate number in a ballot paper. Write a C++ program to read the ballot and count the votes cast for each candidate using an array variable count. In case, a number read is outside the range 1 to 5 the ballot should be considered as a 'spoilt ballot', and the program should also count the number of spoilt ballots

Write a program that dynamically allocates an array large enough to hold a user-defined number of test



scores. Once all the scores are entered, the array should be passed to a function that sorts them in



ascending order. Another function should be called that calculates the average score. The program



should display the sorted list of scores and averages with appropriate headings. Use pointer notation



rather than array notation whenever possible.



Input Validation: Do not accept negative numbers for test scores.



Example



Enter the number of test scores: 4



Enter each test score:



Test#1: 34



Test #2: 73



Test #3: 22



Test #4: 89



Sorted test scores:



Test #1: 22



Test #2: 34



Test #3: 73



Test #4: 89



Average = 54.5

A 1D binary character array is given to you in file “task1.txt”. You are required to find out maximum



consecutive ones in the array.



Note: Read the file and find the exact length of data in a separate function. Use that size to create a



dynamic integer array using pointers. Then, read the file again and insert data into this dynamic array of



exact calculated size. Then You are required to find out maximum consecutive ones in the array.



task1.txt



11010101111110110111010



Expected output:



- maximum consecutive ones are: 111111



- Starting index is: 7



- Length is: 6




10. Consider a two-dimensional array Marks[10][5] having its base address as 2000 and the




number of




bytes per element of the array is 2. Now, compute the address of the element, Marks[8][5],




assuming that the elements are stored in row major order.

Take a real-world scenario of inheritance and implement it in C++ program. Your program should consist of the following: 

1. Use Constructors and appropriate access modifier 2. List and draw Base class and Derived class 3. Show polymorphism (function overriding and function overloading) 4. Multiple inheritance 5. Put the user’s data into a file and display a data from a file to the user. 

6. Implement Abstract class and interface


Write a C++ program that calculates the nth power of numbers from 1 to k. where n

and k will be input by user.

Expected Output:

Input Power value , n: 3

Input k : 5

3rd power of 1 is 1

3rd power of 2 is 8

3rd power of 3 is 27

3rd power of 4 is 64

3rd power of 5 is 125


NESTED LOOP PROBLEM:)

Design an interactive input loop that scans pairs of integers until it reaches a pair in

which the first integer evenly divides the second. Produce the output in the same format

given below.

Expected Output:

Input number pair 1: 4 7

Input number pair 2: 3 16

Input number pair 3: 14 7

Input number pair 4: 10 100

Your desired number pair is (10,100)


Nested Loop problem:-

Write a C++ program to find first positive even number input. Also tell in how many attempts user input positive even number using do while loop.


A finger-print machine is kept in a school. All the students are required to record their finger-print on their arrival . Expected arrival time is common to all the students. For every one minute of late arrival, 50 paise is charged as fine. For example, if the arrival time of student is 9:03:10 and expected time is 9:00:00 then fine is Rs. 2. Given the details of students, their arrival time on a particular day and the expected arrival time, design an OOP model and write a C++ code to print the rollno and the name of the students who came earlier than the arrival time and calculate fine amount. Understand the precode and application program to do the implementation.

Input Format

Number of students

Roll no of Student1

Name of Student1

Arrival time of Student1

Roll no of Student2

Name of Student2

Arrival time of Student2

...

Roll no of Student-n

Name of Student-n

Arrival time of Student-n

 

All time is given in hours followed by minutes followed by seconds

(Perform Operator Overloading of << and >> operators)



LATEST TUTORIALS
APPROVED BY CLIENTS