佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 604|回复: 0

C++ help帮忙下(另一个问题)

[复制链接]
发表于 14-6-2009 12:22 PM | 显示全部楼层 |阅读模式
怎样写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.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

所属分类: 欢乐校园


ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 14-6-2024 11:06 PM , Processed in 0.058241 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表