无法设置输入值的限制

时间:2016-09-17 11:01:05

标签: c++

#include <iostream>
using namespace std;

int main()
{

    int n, value,av,sum = 0;

    cin >> n;

    for(int i=1;i<=n;i++)
    {
        cin >> value;
        sum+=value;
    }
    av=sum/n;

    if (av>=7.5)
    {
        cout<<"READY";
    }
    else{
        cout<<"NOT READY";
    }
    return 0;
}

如何设置输入值的限制,使其大于或等于0且小于或等于10。我尝试了whileif,但随后改变了ouptut。请帮忙

1 个答案:

答案 0 :(得分:0)

public class Enemy {

    Bitmap enemyBitmap;
    int enemySpeed, screenX;
    boolean isEnemyMoving;
    Random random;

    public Enemy (Context context, int screenX) {
        this.screenX = screenX;

        enemyBitmap = BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher);
        random = new Random();
        isEnemyMoving = true;
        enemySpeed = - 3;
    }

    public int getEnemySpeed () {
        return  enemySpeed;
    }
    public Bitmap getEnemyBitmap () {
        return enemyBitmap;
    }

}