0% found this document useful (0 votes)
217 views

Assignment 2 PF

This document provides instructions for Assignment-2 in the EE-112 course. It outlines 7 questions to be answered in C++ code files and describes the formatting for submitting the assignment. Students are warned that plagiarism will result in penalties ranging from losing points to repeating the semester. The questions involve writing programs to create animations using loops, find the student with the highest exam score, calculate LCM and HCF, add multiples of 3 and 5 below 3000, find the maximum and minimum of user inputs, reverse a number, and describe what two code segments do. Answers to the last two questions must be in a text file submitted along with the C++ files. The assignment is due by 12 PM on 23 April 2019

Uploaded by

Adil Shafiq
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
217 views

Assignment 2 PF

This document provides instructions for Assignment-2 in the EE-112 course. It outlines 7 questions to be answered in C++ code files and describes the formatting for submitting the assignment. Students are warned that plagiarism will result in penalties ranging from losing points to repeating the semester. The questions involve writing programs to create animations using loops, find the student with the highest exam score, calculate LCM and HCF, add multiples of 3 and 5 below 3000, find the maximum and minimum of user inputs, reverse a number, and describe what two code segments do. Answers to the last two questions must be in a text file submitted along with the C++ files. The assignment is due by 12 PM on 23 April 2019

Uploaded by

Adil Shafiq
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment-2 EE-112

(Total Marks = 50) (Deadline = 12 PM, 23 Apr 2019)


Note: If found any kind of plagiarism in your assignment, your case will be
forwarded to the disciplinary committee. The minimum penalty will be zero award
in assignment and the maximum penalty will be repetition of your ongoing
semester. “Your future is in your own hands”

You need to submit a folder titled “Your Roll Number_Assignment-2”. This folder
should only have 6 .cpp and 2 .txt files with the title of question number only. Exp:
Q1.cpp for first question’s code.

Q-1 Make following 4 animations using 4 separate loops in one program. (5 Marks)

Q-2 Write a program which takes marks of n courses as input, of m students and output
the students who got the highest aggregate. n should be between 1 to 7 and m should
be between 5 to 75 otherwise it should print invalid inputs and ask for inputs again.
(5 Marks)

Sample Input: n=5, m=5


Roll# C1 C2 C3 C4 C5

1391 80 70 60 14 88

1376 70 80 80 88 89

1374 71 82 50 80 79

1372 77 90 90 99 100

1375 73 83 40 81 69

Sample Output: 1372 has highest Aggregate of 456

Q-3 Take 3 integers a, b and c as input and display their LCM and HCF. Your program
should keep taking inputs and keep displaying LCM and HCF at output until some
character is given at input like ‘A’ or ‘a’. (10 Marks)
Q-4 Add all the natural numbers below three thousand that are multiples of 3 or 5 but not
both. (5 marks)

Q-5 Write a program that takes inputs until user enter -1 and your program tells the
maximum and minimum number. (5 marks)

Q-6 Write a program that takes an input integer from the user and makes
another variable with reverse of the number entered. (10 marks)

e.g. if the number entered is 12345 the number constructed will be 54321

Q-7 What does the following Program do? (5 marks)


1 // Exercise 5.7: ex05_07.cpp
2 // What does this program print?
3 #include <iostream>
4 using namespace std;
5
6 int main()
7 {
8 int x; // declare x
9 int y; // declare y
10
11 // prompt user for input
12 cout << "Enter two integers in the range 1-20: ";
13 cin >> x >> y; // read values for x and y
14
15 for ( int i = 1; i <= y; i++ ) // count from 1 to y
16 {
17 for ( int j = 1; j <= x; j++ ) // count from 1 to x
18 cout << '@'; // output @
19
20 cout << endl; // begin new line
21 } // end outer for
22 } // end main

Q-8 What does the following program segment do? (5 marks)


1 for ( int i = 1; i <= 5; i++ )
2 {
3 for ( int j = 1; j <= 3; j++ )
4 {
5 for ( int k = 1; k <= 4; k++ )
6 cout << '*';
7
8 cout << endl;
9 } // end inner for
10
11 cout << endl;
12 } // end outer for
Note: Write the answers of last two questions in a .txt file and submit with .cpp files of all
other questions.

You might also like