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

Assignment 1

This document outlines an assignment for an Object Oriented Systems & Programming course. It provides 10 programming problems for students to solve in C and C++, including dynamically allocating a 2D array, declaring a pointer to a function, checking if a number is a power of 2, inverting the last 4 bits of an integer, determining if one integer is a multiple of another, comparing and performing calculations on two integers, sorting and outputting three integers, reading distances into a vector and performing calculations, converting decimal to binary, and printing a number and its reverse.

Uploaded by

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

Assignment 1

This document outlines an assignment for an Object Oriented Systems & Programming course. It provides 10 programming problems for students to solve in C and C++, including dynamically allocating a 2D array, declaring a pointer to a function, checking if a number is a power of 2, inverting the last 4 bits of an integer, determining if one integer is a multiple of another, comparing and performing calculations on two integers, sorting and outputting three integers, reading distances into a vector and performing calculations, converting decimal to binary, and printing a number and its reverse.

Uploaded by

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

Jaypee University of Engineering and Technology, Guna

Department of Computer Science and Engineering

Object Oriented Systems & Programming (14B11CI615)

Assignment-1 (Review of C & C++ Introduction)

Floating Date: 13/02/2017 Last Date of Submission: 17/02/2017

1. Write a C program to dynamically allocate a 2-D array of size m x n.

2. Write a C program to declare a pointer to a function accepting an integer and returning


void.

3. Write a C program for one line code to check if a number is a power of 2.

4. Write a C program for one line code to invert the last four bits of an integer.

5. Write a C++ program that declares two integers, determines whether the first is a
multiple of the second and print the result. (Hint: Use the remainder operator)

6. Write a C++ program that prompts the user to enter two integer values in int variables
val1, val2 and find largest, sum, difference, product and ratio of these values.

7. Write a C++ program that prompts the user to enter three integer values, and then outputs
the values in numerical sequence separated by commas. So, if the user enters the values
10 4 6, the output should be 4,6,10. If two values are the same, they should just be
ordered together. So, the input 4 5 4 should give 4, 4, 5.

8. Write a C++ program to read a sequence of double values into a vector. Think of each
value as the distance between two cities along a given route. Compute and print the total
distance. Find and print the smallest and greatest distance between two neighboring
cities. Find and print the mean distance of the neighboring cities.

9. Write a C++ program to convert decimal to binary.

10. Write a C++ program to print the accepted number and its reverse number.

Page 1 of 1

You might also like