You are on page 1of 10

BEFORE FIXING THE ERROR;

AFTER FIXING THE ERROR;

//MUHAMMAD JOSHWAN//
//25DDT21F2066//
//DFC20113 DDTS1//
//LAB TASK 1//
#include <iostream>
#include <string>

using namespace std;

int main ()
{
string star= "********************************";
double priceBag1= 50.55;
double priceBag2= 100.91;
char customerRate= 'A';

cout<<star<<endl;
cout<<"Price for Bag 1 : RM "<< priceBag1<< endl;
cout<<"Price for Bag 2 : RM "<< priceBag2<< endl;
cout<<"Customer Rating is "<< customerRate<< endl;
cout<<star<<endl;

return 0;
}
ii. Then fix the error by complete the program with correct codes. (CL02, P2)

//MUHAMMAD JOSHWAN BIN MUHAMMAD IRWAN JOHNSON


//25DDT21F2066
//PF DFC20113 DDTS1
//LAB TASK QUESTION 2

#include <iostream>
#include <string>

using namespace std;

int main ()
{
string name;
string matricNo; string className;
int labTask1,labTask2; int sum,average;
cout << " Enter Your Details :- " << endl;
cout << " Name : ";
getline (cin,name);
cout << " Matric No : ";
cin >> matricNo;
cout << " Class : ";
cin >> className;
cout << " **************** "<< endl;
cout << " Enter Your Marks : - "<< endl;
cout << " Lab Task 1 : ";
cin >> labTask1;
cout << " Lab Task 2 : ";
cin >> labTask2;
sum = labTask1 + labTask2;
average = sum / 2;
cout << "\n Total Marks : "<< sum << endl;
cout << " Average Marks : "<< average << endl;
cout << " **************** "<< endl;

return 0;

}
DISPLAY YOUR INPUT;

You might also like