INP1501
ASSIGNMENT 2 2025
UNIQUE NO.
DUE DATE: 2025
, Introduction to Programming IA
// INP1501 Assignment 2: Complete Answers
// Author: [Your Name]
// Date: July 2025
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
// Question 1
void check(int num, float value);
float mult(float a, float b);
void time(int &sec, int &min, int &hr);
int countChar(string str, char ch);
// Question 2
// (i)
// int function1() {
// cout << "Inside function function1 " << endl;
// int function2() { // ERROR: Nested function. Fix by moving function2
outside function1.
// cout << "Inside function function2" << endl;
// }
// }
ASSIGNMENT 2 2025
UNIQUE NO.
DUE DATE: 2025
, Introduction to Programming IA
// INP1501 Assignment 2: Complete Answers
// Author: [Your Name]
// Date: July 2025
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
// Question 1
void check(int num, float value);
float mult(float a, float b);
void time(int &sec, int &min, int &hr);
int countChar(string str, char ch);
// Question 2
// (i)
// int function1() {
// cout << "Inside function function1 " << endl;
// int function2() { // ERROR: Nested function. Fix by moving function2
outside function1.
// cout << "Inside function function2" << endl;
// }
// }