Senin, 13 Juni 2011

C++ : Defining Day in C++

Download

I. ALGORITHM
{enter the numbers 1 through 7, will decide today on what isappropriate}

DECLARATION
day_to: integer
day: string
DESCRIPTION
read (day_to)
case (day_to) of
1: day <- 'Monday'2: day <- 'Tuesday'3: day <- 'Wednesday'4: day <- 'Thursday'5: day <- 'Friday'6: day <- 'Saturday'7: day <- 'Sunday;else day <- 'No'end casewrite (days)I. ALGORITHM{enter the numbers 1 through 7, will decide today on what isappropriate}DECLARATIONday_to: integerday: stringDESCRIPTIONread (day_to)case (day_to) of1: day <- 'Monday'2: day <- 'Tuesday'3: day <- 'Wednesday'4: day <- 'Thursday'5: day <- 'Friday'6: day <- 'Saturday'7: day <- 'Sunday;else day <- 'No'end casewrite (days)

Download

C++ : Algorithm and Program Gas Station

Download

I. ALGORITHM
{Create a program to service the pump}

Declaration
rp, ltr, litlit: float {input}
num, jum1: Integer {input}
gasoline, bensin2, bensin3, bensin4: float {input}
Description

Download source code

C++ : Convert Values ​​Letters Figures Become

Download

Example:
Value Letter Value figures

0-12 E
21-40 D
41-60 C
61-80 B
81-100 A

I. ALGORITHM
{Convert a numeric value into the value of letters}

DECLARATION
value: integer
nilai_huruf: char
DESCRIPTION
read (value)
if (value> 0) and (value <= 20) then nilai_huruf <- 'E'else if (value> 20) and (value <= 40) then nilai_huruf <- 'D'else if (value> 40) and (value <= 60) then nilai_huruf <- 'C'else if (value> 60) and (value <= 80) then nilai_huruf <- 'B'else nilai_huruf <- 'A'end ifwrite (nilai_huruf)Download

C++ : Algorithms and Celsius Temperature Conversion Program BecomeReamur, Fahrenheit and Kelvin

Download source code

I. ANALYSIS

The formula for conversion from Celsius to Reamur, Fahrenheit,and Kelvin are as follows:

reamur = 4 / 5 Celsius
Fahrenheit = 9 / 5 C + 32
Kelvin = Celsius + 273

II. ALGORITHM

DECLARATION
C: integer} {degrees Celsius
R: real {degrees reamur}
F: real {degrees Fahrenheit}
K: real {degrees kelvin}
DESKRIPSI
read (C)
R <- 4 / 5 * C {formula R = 4 / 5 * C}F <- 9 / 8 * C + 32 {The formula F = 9 / 5 * C + 32}K <- C + 32 {The formula K = C + 273}
write (R, F, K)

Download

C++ : Between 3 Largest Numbers Determining Integer in C++

download

I. ALGORITHM

{Read three integers, determine the largest number among threenumbers and display it to screen}


DECLARATION

x, y, z: integer


DESCRIPTION
read (x, y, z)
if (x> y) and (x> z) then write ('The biggest number is = x)
else if (y> x) and (y> z) then write (the largest number is = y)
else write (the largest number is z)
end if

II. Source code in C + +

# include
# include

class appeal {
friend istream& operator >> ( istream&, vs& );
public:
appeal (){};
void compare () {
if ((x> y) & & (x> z))
cout <<"the largest number:" <else if ((y> x) & & (y> z))
cout <<"the largest number:" <else
cout <<"the largest number:" <}
private:
int x, y, z;
};

istream& operator>> (istream& in, appeals& number) {
cout <<"Numbers first =";
in>> bilangan.x;
cout <<"The second number =";
in>> bilangan.y;
cout <<"third number =";
in>> bilangan.z;
return ins;
}

int main () {
appeal number;
cin>> number;
bilangan.bandingkan ();

return 0;
}

download

C++ : Algorithms and Programming Calculating Triangle Area

Download

I. ANALYSIS
Input: t (high) area = l * a / 2

II. ALGORITHM


{Reading the real data in the form of long triangular base (a) and high triangle (t) and calculate the extent of the length of the base and a certain high. Area of ​​triangle is calculated by the formula L = 1 / 2 at. The value L in print as the output to the output device.}
DECLARATION a : real {long triangular base, in units of cm} t : real {height triangle, in units of cm} L : real {area of ​​the triangle} DESCRIPTION read (a) read (t) L <- (a * t) / 2 write (L)
III. Source code in C + +
# Include # Include
class circle { friend ostream& operator <<(ostream&, circle&); friend istream& operator>> (istream&, circle&); public: hitung_keliling void () {circumference = 2 * pi * r;} hitung_luas void () {area = pi * r * r;} private: int r; float perimeter, area; };
istream & operator>> (istream& in, circle& A) { cout <<"Finger - finger circle:"; in>> A.r; return is; }
ostream & operator <<(ostream& out, circles& A) { A.hitung_keliling (); A.hitung_luas (); out <<"Circumference =" <download

ALL INFORMATION Copyright © 2011 | Template created by O Pregador | Powered by Blogger