- Class pada hari ini agak mencabar bagi I tapi I suka pada cabaran ini.
- Dalam kelas hari ini miss sporting bagi brekfearst dulu and kelas star pukul 10 a.m.
- miss arahkan all sudn downlod note chapter1,2,3,4,6 in forum.
- Bermula la pegenalan subjek 4 :OPERATORS AND EXPRESSION.
- Bab ini mengenai, ARTIHMETIC OPERATORS,RELATIONAL,LOGICAL.
- Ini asas sahaja... :)
- Kemudian mengenai INCIMENT yang terbahagi kepada 2 iaitu: PRE-INCIMENT & POST-INCIMENT.
- Later,DECREMENT terbahagi kepada dua: PRE-DECREMENT & POST-DECREMENT.
- And baut exercise bab 4 yg miss bagi di dalam kelas by group.
- Selepas habis bab4,terus kepada bab6 yang mencabar bagi aku..hehehe :)
- Bab ini baru sampai mengenai IF...ELSE & SWITCH....CASE
- Enjoy betul dalam kelas ini cz 4hour..hehehe :)
- Group partner yang tidak hadir pada hari ini adalah. Nurfadatul Akmar.
- Last,buat weekly reflection 4 by Group in forum..
- EXERCISE YANG LAST WEEK GROUP I dapat FULL MARK..:):):):)
- HAPPY SANGAT,, :)
#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;
}
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;
}
#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;
}
NOTE CHAPTER4.
OPERATORS AND EXPRESSION.
1. OPERATORS IN C++ PROGRAMMING LANGUAGE.
a)ARITHMETIC OPERATORS.
+-->addition.
_ --> subtraction.
* -->multiplication.
/ -->devision.
% -->modulus.
2.RELATIONAL OPERATORS.
> : greater than.
< : less than.
>= :greater than and equal.
=< :less than and equal.
== :equal.
3.LOGICAL OPERATOR.
&& :and.
! :not.
|| :or.
4.INCIMENT AND DECREAMENT.
INCEMENT=A)Pre-inciment(++n)
B)Post-incimeny(n++)
DECREMENT=A)Pre-decrement(--n)
B)Post-decrement(n--)
5.CONTOH SOALAN.
a)int n;
n=5;
cout<<n;5
cout<<++n;1+5
cout<<n;6
b)int m;
m=10;
cout<<m;10
cout<<m--;10
cout m;9
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;
}
NOTE CHAPTER4.
OPERATORS AND EXPRESSION.
1. OPERATORS IN C++ PROGRAMMING LANGUAGE.
a)ARITHMETIC OPERATORS.
+-->addition.
_ --> subtraction.
* -->multiplication.
/ -->devision.
% -->modulus.
2.RELATIONAL OPERATORS.
> : greater than.
< : less than.
>= :greater than and equal.
=< :less than and equal.
== :equal.
3.LOGICAL OPERATOR.
&& :and.
! :not.
|| :or.
4.INCIMENT AND DECREAMENT.
INCEMENT=A)Pre-inciment(++n)
B)Post-incimeny(n++)
DECREMENT=A)Pre-decrement(--n)
B)Post-decrement(n--)
5.CONTOH SOALAN.
a)int n;
n=5;
cout<<n;5
cout<<++n;1+5
cout<<n;6
b)int m;
m=10;
cout<<m;10
cout<<m--;10
cout m;9
No comments:
Post a Comment