Write one single short C++ program that contains all of the following commands,s
ID: 3670487 • Letter: W
Question
Write one single short C++ program that contains all of the following commands,statements,operators...etc :
1- At least 1 (while or do while) loop.
2- At least 1 logical operators (&& or || or !).
3- At least 1 (char) variable
4 -At least 1 array.
5- At least 1 (string) variable.
B) explain in one or two lines what your program does (use // or */ ).
Please only using these libaries (#include <iostream> - using namespace std;)
Please do not use ( #include <iomanip> - using std::setw; - or others )
Thank you
Explanation / Answer
#include<iostream.h>
void main()
{
int sum=0,a[100],i=0;
char ans='y';
while(ans=='y')
{
cout<<"Enter number";
cin>>a[i];
if(a[i]>=35 && a[i]<=100)
cout<<"Pass";
sum=sum+a[i];
i++;
cout<<"Want to continue [y/n]";
cin>>ans;
}
cout<<"Class total is "<<sum;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.