0% found this document useful (0 votes)
7 views2 pages

OOP Homework 02

This document outlines the homework assignment for the Object Oriented Programming course at the National University of Computer and Emerging Sciences, Lahore Campus, for Fall 2020. It includes important submission guidelines, restrictions on programming practices, and two questions requiring the implementation of a spiral matrix output and a function to compress a C-style string. The assignment is due on September 7, 2020, and is worth a total of 10 marks.

Uploaded by

Aiyshah Meerab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

OOP Homework 02

This document outlines the homework assignment for the Object Oriented Programming course at the National University of Computer and Emerging Sciences, Lahore Campus, for Fall 2020. It includes important submission guidelines, restrictions on programming practices, and two questions requiring the implementation of a spiral matrix output and a function to compress a C-style string. The assignment is due on September 7, 2020, and is worth a total of 10 marks.

Uploaded by

Aiyshah Meerab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

National University of Computer and Emerging Sciences, Lahore Campus

Course: Object Oriented Programming Course Code: CS217


Program: BS(Computer Science) Semester: FALL 2020
Due Date: 07-Sep-2020 11:00 a.m Total Marks: 10
Section: G&H Weight 2%
Evaluation: Homework-02 Page(s): 2

Submission Path: Google classroom

Important Note:
Violation of following will result in marks deduction:

- You cannot use subscript operator [] to manipulate arrays in your program. Instead, use
pointer notation
- There will be marks deduction for every single exception.
- Using Global Variables and “goto” in assignment is NOT ALLOWED.
- We are not taking anything from the user and deallocation of memory is necessary.
- Submit .cpp file with names YourRollNumber.cpp for example, L19-1234.cpp. Also
submit your data files.
- Your assignment will be evaluated on “Data1.txt” and “Data2.txt” provided with
assignment. In case you change text files, submit your updated data file in your folder.

Question 01: [Spiral Matrix Output]

Given N, and an N * N matrix, print the integers of the matrix (in a space separated format) in the spiral
order, clockwise starting from the top left corner.

Input from Data1.txt:


The first line will contain N <=1000.
N*N matrix follows, i.e the next N lines contain N integers each.

Sample Input:
4
1234
12 13 14 5
11 16 15 6
10 9 8 7
Sample Output: (Print the elements of the array separated by space in the manner as described above.)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Question 02: [Compress CString]

Write a function that takes a cstring (character array) and if it finds more than one consecutive
occurrences of a character in the cstring, it removes the extra occurrences. Read input cstrings
from file(‘Data2.txt’) and then send them to the function for required output.

Required Output:

Test Case 1:
String: aaaaaaa
String after compression: a

Test Case 2:
String: hhsaaasjjjaa
String after compression: hsasja

Test Case 3:
String: bbabbbbbcccddddddddddeffffg
String after compression: babcdefg

HAPPY CODING!

You might also like