Thursday, February 17, 2011

Fundamental Of Programming (FOP) - 3rd week

First day of using TURBO C++ software.


Ms. Ayuni asked us to answer a question each for every group present. My group consists of Yani, Mohamad, Azuwan, Badrul, and Amalina. It was a temporary group since a lot of students were not in class yet.



EXERCISE
Multiply and divide 2 FLOAT numbers, num1 and num2.
multiply=num1*num2
divide=num2/num1


FLOWCHART




















# include // header

main () // start body

{ //open curly bracket

// declare variable

float num1;

float num2;

float multiply;

float divide;

// input 1

cout<<"enter num1:";

cin>>num1;

// input 2

cout<<"enter num2:";

cin>>num2;

// formula

multiply=num1*num2;

// output

cout <<"multiply=" <>

// formula

divide=num2/num1;

// output

cout << "divide=" <>

return 0;

} // close curly bracket

// end body



Then Ms. Ayuni asked us to follow instructions as stated below, to open TURBO C++ on the PC;


1. ON your computer --> click "START" -->doubled-click "Computer"














2. Doubled-click " WIN7 C:















3. Choose folder, doubled-click " TC " ,













4. Then choose folder, doubled-click " BIN " ,












5. Then doubled-click " TC " ,













6. Click " Ignore " to go to TURBO C++ ;













7. Click " File ", choose " New " , and may start write your coding using TURBO C++.















We continued with another exercise in our group.


EXERCISE ( TARRAGON )
















#include // header

main() //start body

{//open curly bracket

//declare variable

float bm;

float bi;

float math;

float sains;

float total;

float average;

//input 1

cout<<"bahasa melayu=";

cin>>bm;

//input 2

cout<<"bahasa inggeris=";

cin>>bi;

//input 3

cout<<"matematik=";

cin>>math;

//input 4

cout<<"sains=";

cin>>sains;

///formula

total=bm+bi+math+sains;

//output

cout<<"total=" <>

//formula

average=total/4;

//output

cout<<"average=" <>

return 0;

}//close curly bracket

//end body




NOTES !!!!
  • for INPUT, follow exactly as stated in question. EX: bahasa melayu= .
  • to declare variable, MUST look up in formula given. EX: bm, bi, math, sains.


[[ Weekly reflection & Exercises = group]]
[[ Blog tutorial= individual ]]


Chapter 3 & 4 will be continued on the following week.

-- ALL SMILES -- (",)

No comments:

Post a Comment