很开心呢
自己一个人写好了整个program 的proposal
(什么group work 嘛\("▔□▔)/ ,自己一个人也能完成的功课都要被迫分组(─.─|||)
很有成就感 ^ ^
之前年头design 的program都不能用了
那个是计算女生经期的系统
失败了 呜呜
其实那不是错的
只是达不到老师的要求 =/
老师要一个system里面同时包括looping 和selection
做来做去 都只有selection
looping 做不成功
那2个formula不知道要怎么把它们 ◤LOOP◢在一起
上网也找不到有用的资料
也没有example可以看 (┬_┬)
结果就换成这个
✖乱来✖的
哈哈
一方面可以算出客人最喜欢什么产品
另外帮他们预测和节省预算
简简单单的
容易明白的 simple program <( ̄︶ ̄)>
不要出错就好啦 (>﹏<)
第二个学期的 IT ASSIGNMENT 之一
Pseudo Code for an estimated consumption calculator
START
DISPLAY ‘Please enter your budget:”
ENTER B
DISPLAY ‘Product List’
DISPLAY ‘Code No.
Item Price (RM)’
DISPLAY ‘2104 Product
A - 10.00’
DISPLAY ‘2105 Product
B - 50.00’
DISPLAY ‘2106 Product
C - 100.00’
DISPLAY ‘Which is your favorite item?’
DISPLAY ‘Please enter the code number of item:’
ENTER CN
DISPLAY ‘Please enter the quantity you want:’
ENTER Q
IF
(CN==2104)
P=10.00
ELSE IF (CN==2105)
P=50.00
ELSE IF
(CN==2106)
P=100.00
ELSE
P=0
DISPLAY ‘Wrong code number !’
DISPLAY ‘Your Shopping List Price’
FOR (R=1;
R<=Q; R++)
DISPLAY R,
DISPLAY
‘.’ , CN, P
CALCULATE
T=P*Q
DISPLAY ‘Total Payment:RM’,T
IF (T>B)
DISPLAY ‘Sorry...You are over budget.’
IF (T==B)
DISPLAY ‘You just reach your budget.’
IF (T<B)
DISPLAY ‘You can buy more products. ^ ^’
ELSE
DISPLAY ‘Error…’
DISPLAY ‘Thank you...Please come again =D’
END
Coding
//This is a program to help customer make an
estimated consumption.
#include <iostream.h>
#pragma hdrstop
#pragma argsused
#include <tchar.h>
#include <stdio.h>
int _tmain(int argc, _TCHAR* argv[])
{
int CN, Q, R;
float B, P,
T;
std::cout<<"Please enter your
budget: RM";
std::cin>>B;
std::cout<<endl<<"Product
List"<<endl<<endl;
std::cout<<"Code No. Item
Price(RM)"<<endl;
std::cout<<"2104 Product A - 10.00"<<endl;
std::cout<<"2105 Product B - 50.00"<<endl;
std::cout<<"2106 Product C -
100.00"<<endl<<endl;
std::cout<<"Which is your favorite
item?"<<endl;
std::cout<<"Please enter the code
number of item:";
std::cin>>CN;
std::cout<<"Please enter the
quantity you want:";
std::cin>>Q;
if (CN==2104)
{
P=10.00;
}
else if
(CN==2105)
{
P=50.00;
}
else if
(CN==2106)
{
P=100.00;
}
else
{
P=0;
std::cout<<"Wrong code number
!"<<endl;
}
std::cout<<endl<<"Your
Shopping List"<<"\t\tPrice"<<endl;
for
(R=1; R<=Q; R++)
{
std::cout<<R<<"."<<CN;
std::cout<<"\t\t\t\t"<<P<<endl;
}
T=P*Q;
std::cout<<"\t\t\t\t_______"<<endl;
std::cout<<"Total
Payment:"<<"\t\t\t"<<"RM"<<T<<endl<<endl;
if (T>B)
std::cout<<"Sorry...You are over
budget."<<endl<<endl;
if (T==B)
std::cout<<"You just reach your
budget."<<endl<<endl;
if (T<B)
std::cout<<"You can buy more
products. ^ ^"<<endl<<endl;
else
std::cout<<"Error..."<<endl<<endl;
std::cout<<"Thank you...Please come
again =D"<<endl;
system
("pause");
return
0;
}
SHARING IS CARING
CARING IS LOVING ♥



No comments:
Post a Comment