KMK1093 Lab Exercise Week 01 - 2023
KMK1093 Lab Exercise Week 01 - 2023
LAB 01
KMK1093 BASIC PROGRAMMING
SEMESTER 2023/2024-1
LAB 01
KMK1093 BASIC PROGRAMMING
EXERCISE 1.0
1. Distinguish between “General Purpose Application Software” and “Specific Application Software” ? (if possible
try to relate with the Cognitive Science niche areas)
3. Discuss “possible” guidelines to be followed by a programmer in selecting C++ IDE (Integrated Development
Editor). Explain to students “Installation Procedure”, Dev C++, Netbeans, Code Blocks and any Android C++ IDE
EXERCISE 1.1
#include<iostream>
using namespace std;
int main()
{
cout << “This is our first C++ Program.”<<endl;
cout << ”It Works!”<<endl;
return 0;
}
For each experiment concerning lab01-1.cpp, start with a fresh copy of lab01-1.cp and make the indicated changes
(question 1-question 4) :
1. Delete the #include<iostream> preprocessor directive from lab01-1.cpp. Attempt to compile and
executing the resulting program. What message does your compiler issue ?
2. C++ is case sensitive. Replace the I in the preprocessor directive #include by I and compile the resulting
program. What message does your compiler issue ? Now replace the word cout by COUT. What message the
compiler issue ?
3. Every C++ statement must end with semicolon (;). Intentionally omit the semicolon at the end of the first cout
statement and compile the resulting program. What message does your compiler issue ?
4. The body of the function main( ) must be enclosed in braces { }. Omit either the left brace { or the right brace }
and compile the resulting program. What message does your compiler issue ?
EXERCISE 1.2
1. Which of the following variable declarations are correct? if a variable declaration is not correct, give the
reason(s) and provide the correct variable declaration.
N = 12; //Line 1
character letter = ; //Line 2
INT one = 5, two; //Line 3
Double x, y, z; //Line 4
2. Modify the following program so it prints two blank lines between each line of text.
#include<iostream>
using namespace std;
int main( )
{
cout<<”C++ Primer is a highly recommended, well organised and well-written book “;
cout<<”for those who want to learn C++.”;
cout<<”It is a very thorough introduction to the language in a very accessible format,”;
cout<<”with plenty of examples and explains everything in the language in great detail.”;
return 0;
}
3. Define a correct data type for the following variables :
GST rate
Number of students
Vehicle/Car Brand and Name (such as Subaru, Mitsubishi, Toyota Fortuner, Perodua Alza)
Book category code
4. Write a program that displays “C++” text in block form using asterisks
6. Write a Personal Information program that displays the following information, each on a separate line:
Your name, Your address, with city, state, and zip code,
Your telephone number and
Your Undergraduate program and your faculty name