Monday, March 28, 2011

Exercise 1










#include<iostream.h>
main()
{
      //declare variable
      float num1,num2,num3,calculate;
      //input1
      cout<<"please insert number for num1 =";
      cin>>num1;
      //input2
      cout<<"please insert number for num2 =";
      cin>>num2;
      //input3
      cout<<"please insert number for num3 =";
      cin>>num3;
      //formula
      calculate =(num1*num2)-num3+(num2/num1);
      //output
      cout<<"the answer for the problem is ="<<calculate;
      return 0;
      }

Exercise 2











#include <iostream.h>
main()
{
      //declare
      float cgpa,total,total2;
      char a;
      //input
      cout<<"Please enter your CGPA:"<<endl;
      cin>>cgpa;
      if (cgpa == 4.00)
      {total = (1)*16000;
      total2 = 16000 - total;}
      else if (3.00<=cgpa<=3.99)
      {total = (0.8)*16000;
      total2 = 16000 - total;}
      else if (2.00<=cgpa<=2.99)
      {total = (0.4)*16000;
      total2 = 16000 - total;}
      else if (0<=cgpa<=1.99)
      {total = (0)*16000;
      total2 = 16000 - total;}
      else {cout<<"Invalid CGPA";}
      //output
      cout<<"Your CGPA is "<<cgpa<<endl;
      cout<<"Your Discount "<<total<<endl;
      cout<<"You have to pay "<<total2;
      cout<<"\n\nType quit to exit application"<<endl;
      cin>>a;
      return 0;
      }
    

Integer













#include<iostream.h>
main()
{
      //declare variable
      int multiply,num1,num2;
      //input1
      cout<<"Enter num1:";
      cin>>num1;
      //input2
      cout<<"Enter num2:";
      cin>>num2;
      //formula
      multiply=num1*num2;
      //output
      cout<<"Answer is:"<<multiply;
      return 0;
      }

Homework 2














#include <iostream.h>
main ()

{
     //variable
     float sub1,sub2,sub3,sub4,sub5,cpa;
     //input1
     cout<<"insert subject1:";
     cin>>sub1;
     //input2
     cout<<"insert subject2:";
     cin>>sub2;
     //input3
     cout<<"insert subject3:";
     cin>>sub3;
     //input4
     cout<<"insert subject4:";
     cin>>sub4;
     //input5
     cout<<"insert subject5:";
     cin>>sub5;
     //process
     cpa=((sub1*3)+(sub2*3)+(sub3*2)+(sub4*2)+(sub5*4))/5;
     //output
     cout<<"subject 1:"<<sub1<<endl;
     cout<<"subject 2:"<<sub2<<endl;
     cout<<"subject 3:"<<sub3<<endl;
     cout<<"subject 4:"<<sub4<<endl;
     cout<<"subject 5:"<<sub5<<endl;
     cout<<"CPA is:"<<cpa<<endl;
     return 0;
     }

Homework 1













#include<iostream.h>
main()

{
      //variable
      float as1,as2,as3,as4,as5,mid,final,total;
      //input1
      cout<<"assignment 1:";
      cin>>as1;
      //input2
      cout<<"assignment 2:";
      cin>>as2;
      //input3
      cout<<"assignment 3:";
      cin>>as3;
      //input4
      cout<<"assignment 4:";
      cin>>as4;
      //input5
      cout<<"assignment 5:";
      cin>>as5;
      //input6
      cout<<"midterm:";
      cin>>mid;
      //input7
      cout<<"final:";
      cin>>final;
      //formula
      total = as1+as2+as3+as4+as5+mid+final;
      //output
      cout<<"assignment 1 is:"<<as1<<endl;
      cout<<"assignment 2 is:"<<as2<<endl;
      cout<<"assignment 3 is:"<<as3<<endl;
      cout<<"assignment 4 is:"<<as4<<endl;
      cout<<"assignment 5 is:"<<as5<<endl;
      cout<<"mid score is:"<<mid<<endl;
      cout<<"final score is:"<<final<<endl;
      cout<<"total is:"<<total;
      return 0;
      }

if...else & switch...case











#include <iostream.h>
main()
{
      //declare
      float b,h,r,w,area;
      float c,f,cel,fah;
      float pi=3.14;
      int selection;
      //out
      cout<<"Please choose you choice"<<endl;
      cout<<"1.Rectangular";
      cout<<"\n2.Triangle";
      cout<<"\n3.Circle";
      cout<<"\n4.Fahrenheit";
      cout<<"\n5.Celcius"<<endl;
      cout<<"Your Selection is:"<<endl;
      cin>>selection;
      switch (selection)
      {
         case 1: cout<<"Please input the height"<<endl;
                     cin>>h;
                     cout<<"Please input the width"<<endl;
                     cin>>w;
                     //process
                     area = w*h;
                     cout<<"Your selection is"<<selection;cout<<"and you are calculate Rectangular"<<endl;
                     cout<<"The answer is:"<<area;
                     break;
         case 2: cout<<"Please input the height"<<endl;
                     cin>>h;
                     cout<<"Please input the base"<<endl;
                     cin>>b;
                     //process
                     area = 0.5*b*h;
                     cout<<"Your selection is"<<selection;cout<<"and you are calculate Triangle"<<endl;
                     cout<<"The answer is:"<<area;
                     break;
         case 3: cout<<"Please input the radius"<<endl;
                     cin>>r;
                     //process
                     area = pi*r*r;
                     cout<<"Your selection is"<<selection;cout<<"and you are calculate Circle"<<endl;
                     cout<<"The answer is:"<<area;
                     break;
         case 4: cout<<"Please insert the celcius"<<endl;
                     cin>>c;
                     //process
                     fah= 9/5*(c+32);
                     cout<<"Your selection is"<<selection;cout<<"and you are calculate Fahrenheit"<<endl;
                     cout<<"The answer is:"<<fah;
                     break;
         case 5: cout<<"Please insert the fahrenheit"<<endl;
                     cin>>f;
                     //process
                     cel = 5/9*(f+32);
                     cout<<"Your selection is"<<selection;cout<<"and you are calculate Celcius"<<endl;
                     cout<<"The answer is:"<<cel;
                     break;
         default :cout<<"Invalid Selection";
          return 0;
             }
}

Saturday, March 26, 2011

Sifir












#include <iostream.h>
main()
{
     cout<<"*****"<<endl;
     cout<<"SIFIR"<<endl;
     cout<<"*****"<<endl;
     int a,b;
     char o;
     a=1;
     while (a<=12)
     {
           cout<<"\n";
           for (b=1;b<=12;b++)
           {
               cout<<" "<<a*b;
               }
               a++;
               }
               cout<<"\n\nType EXIT to quit application"<<endl;
               cin>>o;
               return 0;
               }

Mesin minuman













#include <iostream.h>
main()
{
      //declare
      int selection;
      float money,balance,price,addm,add;
      //out
      cout<<"******************"<<endl;
      cout<<"Mesin Tin Minuman"<<endl;
      cout<<"------------------"<<endl;
      cout<<"1.PEPSI";
      cout<<"\n2.COCA COLA";
      cout<<"\n3.F&N MIRINDA";
      cout<<"\n4.F&N ORANGE";
      cout<<"\n5.100 PLUS"<<endl;
      cout<<"******************"<<endl;
      //input
      cout<<"\nPlease Choose Your Drink"<<endl;
      cin>>selection;
     
      cout<<"\nPlease Enter MONEY: ";
      cin>>money;
     
      switch (selection)
      {
             case 1: cout<<" Your drink is Pepsi";
                     price = 2.00;
                     break;
             case 2: cout<<" Your drink is Coca Cola";
                     price = 2.00;
                     break;
             case 3: cout<<" Your drink is F&N Mirinda";
                     price = 1.80;
                     break;
             case 4: cout<<" Your drink is F&N Orange";
                     price = 1.80;
                     break;
             case 5: cout<<" Your drink is 100 Plus";
                     price = 2.50;
                     break;
             default: cout<<"invalid selection";
             }
     
      if (money>price)
      {
                      balance = money - price;
      }else if (money<price)
                           {
                            add = price - money;
                            cout<<"Please add (RM" <<add<< ")= ";
                            cin>>addm;
                            balance = money + addm;
                            }
                            cout<<"Your balance is "<<balance;
                            return 0;
}

Weekly Reflection 4

Weekly Reflection 4 ni da lama da terlepas...(24 February 2011)
anyway here it is

-Class bermula pada kol 10.
-miss memberi notes 1,2,3,4,5,6 di dalam forum dan suruh download.
-study chapter 4 arithmetic operators, relational operators, logical operators.
-buat exercise logical operator by group dan ade (5mark)
-study chapter 6 decision
-buat exercise by group if...else & switch case.
-miss memberi homework 6 exercise secara individu dan perlu dipostkn di dalam blog sendiri.

as usual credit goes to our leader Nas for this Weekly Reflection

Sunday, February 27, 2011

Assignment 1

haih~~~~
atas sebab-sebab tertentu yg  agak payah untuk dijelaskan....
terpaksa la post assignment yang miss bagi dgn meng-sharing file tersebut....
nanti aq post sepenuhnya bila da kewangan aq stabil....or plg lmbt ari isnin yg terdekat
[EDIT]
Da ble post

1.    Write correct C++ syntax & for each statement below:

a) Initializing variable Pi with the value 3.14 (constant)

    Const float Pi=3.142;

b) Declare a variable named Parameter with double data type (declare variable)

      Double parameter

c) Give instruction that allowed user to input data (input)
   
    Cout<<”please insert your score”;
  
d) Input number of computer using variable (input assign to variable value)

    //variable nc=number of computer
    Int nc;
    //input
    Cout<<”Insert number of computer:”;
    Cin>>nc;


1.    Solve the question below. Show the working.

a) 5 * 2 % 3 + 25 / 5
    [(5*2)%3] + [25/5]
    [(10)%3] + [5]
    [1] + [5]
    6

b) a = 5, b = 6

    !((a < 3) && (a == 3) || (b > 9))
    NOT[(5<3:0)&&(5==3:0) || (6>9:0)]
    NOT[(0&&0) || 0]
    NOT[0 || 0]
    NOT[0]
    1

2.    Identify syntax errors in the following program.

#include<iostream.h>
main()
{
float allowance = 300.00, salary
, TSalary;

cout<<"Input Salary = ";
cin>>salary;

TSalary = salary +
allowance;

cout<<"Salary is= "<<
salary;

return 0;
}

3.    Write a program that will calculate the monthly salary for an employee that where Saturday and Sunday are considered as non-working days.

#include <iostream.h>
main()
{
      //declare
      float allowance=500.00,salary=40,tsalary,day;
      //input
      cout<<"please input total days work";
      cin>>day;
      //process
      tsalary = (salary*day)+allowance;
      //output
      cout<<"The total salary for this month is:RM "<<tsalary;
      return 0;
      }

4.    Write a program that calculates the average of 5 numbers that can be input by user.

#include<iostream.h>
main()
{
//declare variable
float a,b,c,d,e,average;
//input
cout<<”please insert 5 numbers here: \nExample: a,b,c,d,e”<<endl;
cin>>a, b, c, d, e;
//process
average = (a+b+c+d+e)/5;
//output
cout<<”The average is:”<<average;
return 0;
}

5.    Write a program that will calculate the area of rectangular, triangle and circle.

#include <iostream.h>
main()
{
      //declare
      float b,h,r,w,area,;
      float pi=3.14;
      int selection;
      //out
      cout<<"Please choose you choice"<<endl;
      cout<<"1.Rectangular";
      cout<<"\n2.Triangle";
      cout<<"\n3.Circle"<<endl;
      cin>>selection;
      switch (selection)
      {
             case 1: cout<<"Please input the height"<<endl;
                     cin>>h;
                     cout<<"Please input the width"<<endl;
                     cin>>w;
                     //process
                     area = w*h;
                     cout<<"The area is:"<<area;
                     break;
             case 2: cout<<"Please input the height"<<endl;
                     cin>>h;
                     cout<<"Please input the base"<<endl;
                     cin>>b;
                     //process
                     area = 0.5*b*h;
                     cout<<"The area is:"<<area;
                     break;
             case 3: cout<<"Please input the radius"<<endl;
                     cin>>r;
                     //process
                     area = pi*r*r;
                     cout<<"The area is:"<<area;
                     break;
             default :cout<<"Invalid Selection";
             return 0;
             }
}

Tuesday, February 8, 2011

Weekly Reflection 3

Kali nie kitaorng berjaya bgn pagi dan dpt hadir ke ke kelas....
sampai kelas miss suruh kitaorang download Turbo C++ tp memandangkan lappy aq x ble install aq guna Dev C++ n settle hal aku

-Breakfast 9am-10am.
-Download TURBO C++ 32bit di forum.
-Tutorials buat blogspot.
-Miss bagi latihan Coding C++ :
1. Calculate 3 numbers with using the formula below :-
calculate = (num1*num2)-num3+(num2/num1)

-Masok latihan dlm Weekly Reflection 3.
-Sume ahli hadir.
-Semua ahli bagi kerjasama dan telah memberikn komitmen yg terbaik.

Weekly reflection credit goes to Ezwanjb

Weekly Reflection 2

Aku x datang plk waktu Weekly Reflection 2 nie....
so aku copy lg skali dari forum and as usual credit goes to Nas[Leader]

-register forum untuk group FOP. web http://lect-ayuni.forumms.net
-mencari 3 perbezaan antara procedural programming , structured programming dan object oriental programming diberi masa selama 45 minit post ke dalam forum web http://lect-ayuni.forumms.net
-belajar chapter 2 c++ programming language
-chapter 2 miss mengajar program layout dan perlu memahami bagi untuk tulis didalam weekly reflection 2
-selain itu masukkan weekly reflection 1 ke dalam forum
-kemudian buat weekly reflection 2 by group . kemudian masukkan wekkly relection 2 ke dalam forum sekali
-masukkan tugasan integer multiply num 1 * num 2(programming) ke dalam forum miss
-2 orang ahli tidak datang , faris dan izwan

Weekly Reflection 1

Aku da ingat sgt weekly reflection 1 nie....nasib baik leader aku ada buat kat forum
Credit to: Nas [Leader]

-Orientasi suai kenal
-rehat 15 minit , breakfast
-pembahagian kumpulan
-pengenalan subjek chapter 1
-belajar tentang algorithm , pseudo code , flowchart
-algorithm > ayat panjang
-pseudo code > bentuk pergerakkan program
-buat weekly reflection
-buat assignment tentang perbezaan antara procedural programming , structured programming and object oriented programming
-buat forum
-zip file
-kena buat blogspot

Saturday, January 29, 2011

FOP hajimete no kurasu

wow......first time wat blog satu benda aq x phm.....assignment nyer pasal wat jer la "-.-

DATE: 25/01
TIME: 9 a.m-1.p.m

Kelas pertama FOP aq dtg lewat.....awl² lg aq da dtg lewat....smua vietnam nyer pasal..
anyway kelas pertama ni kitaorang diterangkan tentang apa tu FOP and wat should we do
so first thing first we were told about assignment n this blog is one of it....
ringkas cerita settle jer benda² tentang assignment n watsoever kitaorang start chapter 1

Introduction to FOP
kat cni kita belajar la tentang cara² wat P....kesian gak kat budak² e-bisnes
yela mana x nyer ambek course bisnes blaja wat P sure fried brain diorang da la x blaja PPSC lagi
diteruskan cerita kitaorang belaja la wat Flowchart, Algorityhm, and lastly Pseudocode
Aduhai.....smua ni kacang jer utk aq coz da blaja  PPSC tp x sangka plk ade sedikit beza ngan apa yg aq blaja kat PPSC....Miss kitaorang bg la sedikit latihan n after that chapter 1 pun abis. Nanti aq letak la pix² utk tiga benda kat atas tadi....

Sblm tu kitaorang disuruh wat team..5 people in 1 group. Nama team kitaorang adalah Echelon Tech. 
For people yang nak taw apa tu echelon tech baca la manga BloodyMonday dan aq rekomen cita ni bg yg PC maniac. Setiap team kena ade rules n motto....coz mls nak tulis panjang² aq bg taw motto team kitaorang jer iaitu Impossible Maneuver But Accomplished . Bagi sapa yg maen DOTA pasti korg perasan secret meaning kat dlm motto tu.

This is all for today later i post again about my FOP class and maybe some people out there wondering wat FOP and PPSC stands for rite??
F O P : Fundamentals Of Programming
P P S C : Problem Programming Solving Concept