佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1119|回复: 2

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

[复制链接]
发表于 14-6-2009 12:21 PM | 显示全部楼层 |阅读模式
怎样写while loop 的algorithm?
还有, 如果cout 那边很多字的话,纯粹是字体,那在algorithm 也要写出来?
#########################################################
sample
    cout<<"The Coursework is divided in to 2 assignments,mid-termtest and 2 lab tutorials.The assignments will contribute 10%each to thefinal grade."<<endl;

##########################################################


#include <iostream.h>
void main()
{
    double x,y,z;
   cout<<"The Coursework is divided in to 2assignments,mid-termtest and 2 lab tutorials.The assignments willcontribute 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 and2lab 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

发表于 14-6-2009 01:41 PM | 显示全部楼层

回复 1# 风之女神 的帖子

根据我学校所教,algorithm 像step by step ,
1. Set double x, y, z.
2.Output:The Coursework is divided in to 2 assignments, mid-termtest and2lab tutorials.The assignments will contribute 10% each tothe finalgrade.
3.Outputlease Enter Your Assignment 1 mark ! (100%)
4.Input x
5.while(x>100 || x<0)
5.1.Outputlease Enter Your Assignment x mark ! (100%)
5.2. input x
6.while(x>100 || x<0)
6.1.Outputlease Enter Your Assignment y mark ! (100%)
6.2 input y
7.sum x and y to z.
8.Output:z
回复

使用道具 举报

发表于 14-6-2009 08:50 PM | 显示全部楼层
应该把process flow跟algorithm的分别搞清楚先。。。
回复

使用道具 举报

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

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


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

GMT+8, 6-12-2025 08:05 PM , Processed in 0.142066 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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