Answer to Question #164112 in C++ for Ahsaam

Question #164112

Question No. 01

Write a program that input numbers from the user until user press “E”. Program should display total number of positive and negative numbers entered.  


1
Expert's answer
2021-02-16T17:26:51-0500
#include<iostream>
using namespace std;
int main(){
    

int i=1,m,p=0,n=0;

char e='t';
while(e!='e'){
cout<<"enter number"<<endl;
cin>>m;
if(m>=0){p=p+1;}

if(m<0){n=n+1;}

cout<<"press E TO QUIT"<<endl;
cin>>e;
}
cout<<"positive numbers="<<p<<"\t negative numbers="<<n<<endl;
    return 0;}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog