Write one single short C++ program that contains all of the following commands,s
ID: 3670564 • 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; - void main() or others )
please cover everything
Please if don't know don't how get all of this in 1 program Dont answer
My course is HVAC and I don't need to know C++ I just need to pass
This is the 7th time I asked this qustion nobdy ever includes the 5 codes
Thank You
Explanation / Answer
#include<iostream>
using namespace std;
int main()
{
int i=0;
char str[50]="Welcome into the world of array";
char choice='y';
int a[]={1,2,3,4,5,6};
cout<<str;
do
{
cout<<a[i];
cout<<" Do you want to display the next element of the array...";
cin>>choice;
i++;
}while((choice=='y'||choice=='Y')&&i<(sizeof(a)/sizeof(a[0]))); //sizeof(a)/sizeof(a[0])) is to find total number of elements of the array.
cout<<"All the elements of the array have been successfully displayed"
return 0;
}
//this program uses the do while loop to iterate over the elements of the array and it displays the one by one elements after asking the user if he/she wants to disply the next element in the array.....
//The string at the start displays the welcome greeting message.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.