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

Moc Exam

Uploaded by

s1116035
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)
21 views2 pages

Moc Exam

Uploaded by

s1116035
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/ 2

YUAN ZE UNIVERSITY – Fundamental Computer Programming- C++ Lab(I)

Mock Examination
Problem 1: Write a program to input a square 2D-matrix with m rows and m columns. Then output the
transposition matrix to the screen.

Input: Output:

Please input m: 3 The transposition matrix:

1 2 3 1 2 9

2 5 5 2 5 4

9 4 2 3 5 2

Problem 2: Write a program to count the total number of words in a string

Input: Output:

I am a student from C++ class The total number of words: 7

Problem 3: Write a program to find the frequency of characters.

Input:

Input the string : This is a test string

Input the character to find frequency: i

Output :

The frequency of 'i' is : 3

Problem 4: Create a list of employees, each employee is considered as a structure including the fields
Fullname, Age, and Salary. Enter some employees in the list, sort the list by their age, print the sorted
list to the screen.
struct employee{
string fullname;
int age;
double salary;
};
Input: Please in put n: 3

Input employee #1:

Full name: Lin Jia-Hao

Age: 21

Salary: 26400

Lecturer: Quang-Thai Ho
YUAN ZE UNIVERSITY – Fundamental Computer Programming- C++ Lab(I)

Output:

FULL NAME Age Salary

Lin Jia-Hao 21 26400

Huang Mei-Ling 20 25800

Chen Zhi-Yong 23 32000

Problem 5: Write a problem to read a number list from a file unordered_list.dat. Then, sort the list in
ácending order and write the sorted list back to another file named ordered_list.dat

Input file unordered_list.dat

165279483

Output file ordered_list.dat

123456789

Lecturer: Quang-Thai Ho

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy