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

Worksheet 6 (Array, Pointer, String)

The document outlines a worksheet for CSSE-133 Programming Fundamentals I at MicroLink Information Technology College, detailing programming tasks involving arrays, pointers, and strings. It includes exercises such as replacing negative numbers with their absolute values, finding minimum values, removing items from arrays, and creating histograms. Each task requires writing and testing C++ programs to demonstrate understanding of fundamental programming concepts.

Uploaded by

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

Worksheet 6 (Array, Pointer, String)

The document outlines a worksheet for CSSE-133 Programming Fundamentals I at MicroLink Information Technology College, detailing programming tasks involving arrays, pointers, and strings. It includes exercises such as replacing negative numbers with their absolute values, finding minimum values, removing items from arrays, and creating histograms. Each task requires writing and testing C++ programs to demonstrate understanding of fundamental programming concepts.

Uploaded by

frodereje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

MicroLink Information Technology College

Department of Computer Science


CSSE-133 Programming Fundamentals I
Worksheet 6 (Array/Pointer/String)
1. Write and test a program that replaces all the negative numbers in an array of integers with
their absolute values.

2. Write and test a program that returns the minimum value stored in an array.

3. Write and test a program that returned the index of the minimum value stored in an array.

4. Write and test a C++ program that attempts to remove an item from an array:

5. Write and test a program that adds element-wise 2 one-dimensional int arrays of the same
size. For example, if the two given arrays are
22 33 44 55
and
7 4 1 -2
then the third array would be assigned
29 37 45 53
6. Write a C++ program that accepts any word from keyboard to display the word’s reverse.

Example: Input : Ethiopia

Output: aipoihtE

7. Write a program that reads a sequence of words from the console until the word stop is
entered, and then prints the reversed sequence (without the final stop).

Example: Input: Gallia est omnis divisa in partes tres stop

Output: tres partes in divisa omnis est Gallia

8. Write a program that reads a sequence of positive integers (until the user enters a non-
positive number) and then prints a histogram of all the integer value between the smallest and
the largest integer the user has entered, i.e., for each such value the number of occurrences of
that value in the sequence entered by the user.

Example: Input: 5 10 12 7 10 10 5 11 7 12 10 0

Output:
MicroLink Information Technology College
Department of Computer Science
CSSE-133 Programming Fundamentals I
Worksheet 6 (Array/Pointer/String)
1. Write and test a program that replaces all the negative numbers in an array of integers with
their absolute values.

2. Write and test a program that returns the minimum value stored in an array.

3. Write and test a program that returned the index of the minimum value stored in an array.

4. Write and test a C++ program that attempts to remove an item from an array:

5. Write and test a program that adds element-wise 2 one-dimensional int arrays of the same
size. For example, if the two given arrays are
22 33 44 55
and
7 4 1 -2
then the third array would be assigned
29 37 45 53
6. Write a C++ program that accepts any word from keyboard to display the word’s reverse.

Example: Input : Ethiopia

Output: aipoihtE

7. Write a program that reads a sequence of words from the console until the word stop is
entered, and then prints the reversed sequence (without the final stop).

Example: Input: Gallia est omnis divisa in partes tres stop

Output: tres partes in divisa omnis est Gallia

8. Write a program that reads a sequence of positive integers (until the user enters a non-
positive number) and then prints a histogram of all the integer value between the smallest and
the largest integer the user has entered, i.e., for each such value the number of occurrences of
that value in the sequence entered by the user.

Example: Input: 5 10 12 7 10 10 5 11 7 12 10 0

Output:

You might also like