查看: 604|回复: 0
|
C++ help帮忙下(另一个问题)
[复制链接]
|
|
怎样写while loop 的algorithm?
还有, 如果cout 那边很多字的话,纯粹是字体,那在algorithm 也要写出来?
#########################################################
sample
cout<<"The Coursework is divided in to 2 assignments,mid-term test and 2 lab tutorials.The assignments will contribute 10%each to the final grade."<<endl;
##########################################################
#include <iostream.h>
void main()
{
double x,y,z;
cout<<"The Coursework is divided in to 2 assignments,mid-termtest and 2 lab tutorials.The assignments will contribute 10%each tothe final grade."<<endl;
cout<<"Please Enter Your Assignment 1 mark ! (100%)"<<endl;
cin>>x;
while(x>100 || x<0)
{
cout<<"Please Enter Your x marks (100%)"<<endl;
cin>>x;
}
cout<<"Please Enter Your y mark ! (100%)"<<endl;
cin>>y;
while(y>100 || y<0)
{
cout<<"Please Enter Your y mark ! (100%)"<<endl;
cin>>y;
}
z=x+y
cout<<"z<<endl;
return0
}
###########################################################
那他的algorithm 是这样写吗?
begin
print "The Coursework is divided in to 2 assignments, mid-termtest and2 lab tutorials.The assignments will contribute 10% each tothe finalgrade"
print"Please Enter Your x marks (100%)"
input x
while (x>100 || x<0)
{input x}
print"Please Enter Your y marks (100%)"
input y
while(y>100 || y<0)
{input y}
z=x+y
print z
end. |
|
|
|
|
|
|
| |
本周最热论坛帖子
|