Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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;
}
      

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote