LAB1

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5

COMPUTER SCIENCE PROGRAM

FACULTY OF COMPUTING AND INFORMATICS


UNIVERSITI MALAYSIA SABAH

KT14303 PROGRAMMING PRINCIPLES


Lab 01 Introduction to Programming

Student Matric No: BI22160523


Student Name: IRFA IRSYA BINTI SUHAIZAN
Program: HC00/ HC05 / HC14

Learning Objectives/Outcomes:
Upon completion of this lab, the student should be able to:
• use the smartv3 system for gaining the course learning materials, taking the
quizzes and
tests, submitting the course works and joining the discussion forum (Practice
1)
• familiar with C++ Integrated Development Environment (IDE) for coding,
compiling and
debugging C++ program (Practice 2)
• write a C++ program structure, including the comments, preprocessor directive,
main
function, standard libraries such as input stream (cin), comments, white
space and basic
formatting (e.g. ‘\n’, ‘\t’, etc.) (Practice 3 & Practice 4)

INSTRUCTION: ANSWER ALL QUESTIONS

Practice 1: Working with SmartV3 system (Estimate 15 minutes to 30 minutes)


i. Login to the smartv3 system.
ii. Take the mock test.
iii. Download Lab 1 question.
iv. Submit lab 1 coursework.

Practice 2: Working with C++ IDE (Estimate 15 minutes to 30 minutes)


The C++ IDE tools could be assessed through the following websites. Download and
install the
Program.

• Visual Studio Community https://visualstudio.microsoft.com/vs/community/


• Eclipse - https://www.eclipse.org
• NetBeans IDE - https://netbeans.org/features/cpp/
• DevC - http://www.bloodshed.net
• ChIDE - https://www.softintegration.com

After the installation, familiar yourself with the installed C++ IDE environment:
i. Writing and editing C++ Code
ii. Configure your compiler and build your C++ project
iii. Debugging the Program under the debugger or running in debug mode to
investigate the
problems

Copyright © Universiti Malaysia Sabah


Practice 3: Structure of C++ Program (Estimate 15 minutes to 30 minutes)
Write your first C++ Program that displays the message “Welcome to KT14303
Programming
Principle Faculty of Computing and Informatics Universiti Malaysia Sabah!” inside a
box on the
console screen, as shown in Figure 1 below. Do your best to approximate lines with
characters
such as ‘|’ or ‘-‘.

SAMPLE RUN :

===================================================
# Welcome to KT14303 Programming Principles! #
# Faculty of Computing and Informatics, #
# Universiti Malaysia Sabah. #
===================================================

Figure 1: Sample – basic info

Practice 4: Modify Practice 3 (Estimate 15 minutes to 30 minutes)


Improve Practice 3 by including your name, matric no and your personal motto . An
example is
shown in Figure 2 below.

SAMPLE RUN :

=====================================================
# Welcome to KT14303 Programming Principles! #
# Faculty of Computing and Informatics, #
# Universiti Malaysia Sabah. #
# STUDENT NAME #
# BI22XXXXXX #
# while (! (succeed =try())); #
=====================================================

Figure 2: Sample – extended version

Copyright © Universiti Malaysia Sabah


ANSWER:

Practice 3

// Practice3.cpp : This file contains the 'main' function. Program execution begins
and ends there.
//

#include <iostream>
using namespace std;

int main()
{
cout <<
"=========================================================" << endl;
cout << "#\tWelcome to KT14303 Programming Principles!\t#" << endl;
cout << "#\t Faculty of Computing and Informatics,\t\t#" << endl;
cout << "#\t Universiti Malaysia Sabah.\t\t#" << endl;
cout <<
"=========================================================" << endl;
return 0;
}

Practice 4

// Practice4.cpp : This file contains the 'main' function. Program execution begins
and ends there.
//

#include <iostream>
using namespace std;

int main()
{
cout << "=========================================================" << endl;
cout << "#\tWelcome to KT14303 Programming Principles !\t#" << endl;
cout << "#\t Faculty of Computing and Informatics,\t\t#" << endl;
cout << "#\t Universiti Malaysia Sabah.\t\t#" << endl;
cout << "#\t Irfa Irsya Binti Suhaizan\t\t#" << endl;
cout << "#\t\t BI22160523\t\t\t#" << endl;
cout << "#\t\t Enjoy Your Life\t\t\t#" << endl;
cout << "=========================================================" << endl;
return 0;
}

***************************** THE END ******************************

You might also like