C++ Answers

Questions answered by Experts: 9 913

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!

Search

C++ program that will initialize an array variable with your names and the print out the names


What is the output of this program (if any)


#include<iostream.h>


using namespace std; 


void main() 

{

int num=123;

int *p_num;

cout<<"if any"<<"\n";

cout<<num<<"\n";

cout<<&num<<"\n";

cout<<*p_num<<"\n";

cout<<p_num<<"\n";

}


Write a C++ program that outputs the following elements in the diagram using Queue data structure

what is the index of the second element of an array


what is the index number of the last element of an array of size 20


Using do while loop, write a C++ program that will compute and display the square roots of the 30 even positive integers starting from 100.



Output:

Square Root of 100: 10

Square Root of 102: 10.0995

Square Root of 104: 10.198

Square Root of 106: 10.2956

Square Root of 108: 10.3923

Square Root of 110: 10.4881

:

:


write program to ask user to enter 4 numbers and the output the main of thes mumbers,this program should only use 2 varible


Write a program that shows a traffic light simulation along with road path in c++


3. Negative Allergy


by CodeChum Admin



Whole numbers are great, but I think we should also pay attention to decimal numbers, too.





So, how about we make a program that involves a lot of decimals?







Instructions:



Continuously ask for floating point values (decimal numbers) using the do…while() loop, sum them all up, and store the total into one variable.


The loop shall only terminate for the following reasons:


A negative decimal number is inputted (but still included in the total sum)


The total sum reaches 100.0 or more


Input



Multiple lines containing float number on each.



1.1


1.2


1.3


1.4


-1.0


Output



A line containing a float number with two decimal places.



4.00

2. Against All "Odds"

by CodeChum Admin


Looping numbers is fun, but it's even more exciting when we combine complex tasks to it, just like looping through a series of numbers and performing a series of code only to special numbers, like odd ones! And today, we're going to do just that.




Are you ready?






Instructions:


Input a random positive integer. This will serve as the starting point of the loop.

Using a while() loop, print out all the odd numbers starting from the inputted integer, until 0. The outputted numbers must all be separated by line.

Input


A line containing an integer.


10

Output


Multiple lines containing an integer.


9

7

5

3


LATEST TUTORIALS
APPROVED BY CLIENTS