Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Arrays in c++

Rating
-
Sold
-
Pages
2
Grade
B
Uploaded on
01-07-2025
Written in
2024/2025

A collection of beginner-friendly questions covering 1D and 2D arrays, array operations, and logic-building exercises. Perfect for mastering array concepts for exams, assignments, and interviews.

Institution
Course

Content preview

Assignment 2
Arrays

1. Write a function called reversit() that reverses a C-string (an array of
char). Use a for
loop that swaps the first and last characters, then the second and next-
to-last characters, and so on. The string should be passed to reversit()
as an argument.
Write a program to exercise reversit(). The program should get a string
from the user,
call reversit(), and print out the result. Use an input method that allows
embedded
blanks. Test the program with Napoleon’s famous phrase, “Able was I
ere I saw Elba.”



2. Start with a program that allows the user to input a number of
integers, and then stores them in an int array. Write a function called
maxint() that goes through the array, element by element, looking for
the largest one. The function should take as arguments the address of
the array and the number of elements in it, and return the index
number of the largest element. The program should call this function
and then display the largest element and its index number.



3. Write a C++ program that multiplies two matrices A & B of dimensions
4×4. (Look into how two 02-dimensional array are multiplied.

4. Write a C++ program that finds the inverse of a 3×3 matrix. (Look
into how the inverse of a matrix if possible calculated)

5. Write a C++ program that stores 100 integers in an array and then
bubble sort the array in ascending order. (Look into how bubble sort
is performed)

Written for

Course

Document information

Uploaded on
July 1, 2025
Number of pages
2
Written in
2024/2025
Type
Exam (elaborations)
Contains
Only questions

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
hadiqagulzar

Get to know the seller

Seller avatar
hadiqagulzar NUST College of Electrical & Mechacical Engineering
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
9 months
Number of followers
0
Documents
9
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions