c++中if,while

[复制链接]
查看11 | 回复2 | 2010-3-25 09:00:02 | 显示全部楼层 |阅读模式
#includevoid main(){ int num1,num2,rest; cin>>num1>>num2; if(num1>num2){ while(num2!=0) {rest=num1%num2;num1=num2;num2=rest; } cout<<num1<<endl;} else {while(num1!=0){ rest=num2%num1; num2=num1; num1=rest;} cout<<num2<<endl;}}帮你改了一下试一试这个
回复

使用道具 举报

千问 | 2010-3-25 09:00:02 | 显示全部楼层
二楼 正确
回复

使用道具 举报

千问 | 2010-3-25 09:00:02 | 显示全部楼层
呵呵,简单的错误,等于在C++中式==不是=
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行