samedi 30 janvier 2021

Stuck if-statement

#include<iostream>
using namespace std;
int main(){
double weight;
cout<<"Enter the weight of the package \n";
cin>>weight;
if(weight>0.0 || weight<= 1.0){
cout << "The shipping cost is 3.5 Dhs";}
else if (weight>1.0 || weight<=3.0){
    cout << "The shipping cost is 5.5 Dhs";
}
else if(weight>3.0 || weight<=10.0){
    cout << "The shipping cost is 8.5 Dhs";
}
else if (weight>10.0 || weight<=20.0){
    cout << "The shipping cost is 10.5 Dhs";
}
else{
    cout<<"Invalid weight";
}
}

Every time I try to enter a different weight it is always stuck in the first condition

Aucun commentaire:

Enregistrer un commentaire