Professional Documents
Culture Documents
DFC2073
Programming
Fundamentals
NAME
REGISTRATION NO
CLASS
2. cin
Header file : iostring.h
Syntax : cin>>item1;
Example :
3. Comment
4. Escape Sequence
Syntax :
Example :
5. Declare Variable
Syntax :
Example : a) Declare integer variable : int Nombor1 ;
b) Declare floating point variable : float Nombor2;
c)
2.0 PROGRAM & OUTPUT
You must prepare IPO and Flowchart when stated in the labsheet, not all.
You must write comment for you coding at IMPORTANT line only, not all.
LAB 1 A
2.1.1 IPO
IPO :
Input G1,G2,G3,G4,G5,Avg
Process Avg = (G1+G2+G3+G3+G5)/5
Output Avg
2.1.2 Flowchart
2.1.3 Program Lab1A
( copy and paste from VC++ )
//This program is used to encounter the problem with cin.
#include<cstdio>
#include<iostream>
using namespace std;
void main ()
{
gets(Clear); //dkdkldkl;dkldkldkl
cout<<"\nPlease key in your Sur Name : ";
gets(Surname);
cout<<"\nnAge : "<<Age;
cout<<"\nSurname : "<<Surname<<endl;
}
2.1.4 Output Lab1A
Display your name, registration no. and class in every output.
_________________________________________________________________
2.1.6 Discussion :
Lab1A
1. Warning occur after compiling:
Possible loss of data when convert from float to double.
avg=(g1+g2+g3)/3.0;
2.2.3 Discussion :
3.0 REFERENCE
Please follow APA format.
Font= Arial, 12.
Spacing 1.5
Marking Scheme :
i. Problem solving, Q&E & Code 25 Marks
ii. Code Readability / Comment 2 Marks
iii. Theory & Discussion 3 Mark
Total : 30 Marks