Questions: 11 448

Answers by our Experts: 10 707

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 & Filtering

Write a program that uses a do-while loop to add integers by the user. In the loop condition, use a variable of type char, in which you can store the user’s answer to the question, “Do you want to enter another number?” when the loop is terminated, the program should output the total of all the inputs. To extend the program, add a nested while loop to ensure the user answers the “…another?” question sensible (with a ‘y’ or ‘n’).


Create a program that uses a do-while loop to count the number of characters (not including whitespace) entered by the user. The count should end when it first encounters a # character in the input. 


Create a program that loops 30 times, but only outputs numbers that are not divisible by 3 or 5. Decide on the most appropriate form of a loop, and use an if statement inside it


Write a program that iterates through the odd numbers less than 30, and outputs the square of each number


Calories = ( (Age x 0.2757) + (Weight x 0.03295) + (Heart Rate x 1.0781) — 75.4991 ) x Time / 8.368

Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output the average calories burned for a person.

Output each floating-point value with two digits after the decimal point, which can be achieved by executing

cout << fixed << setprecision(2); once before all other cout statements.


Write a C++ program that creates two double-type one dimensional arrays Radius and Area of size 10 elements each. In array Radius, get 10 input values (radius of 10 circles). The program should calculate the area of circles for 10 inputted radius values, and store in the corresponding positions in array Area. In the end, program should display 10 calculated areas for the circles.  


Important Note: Use pointer notation to access elements of arrays “Radius” and “Area” (for input, computation, and output).  



Formula: Area = 3.14 * (radius * radius);


Write a C++ program called “Eliminate evens”. First, create an array named “values” having 10 elements of integer type. Then, the program should ask the user to enter values (which may be negative as well as positive) in this array. After that, the program replaces each array element which is odd with an even value. Positive odds should be replaced by even values by adding 1 to them while the negative odd values must be replaced by adding -1 to them. In the end, the program shows the updated array.




Please Note: Array input, output, and other accesses must be done using pointer notation only (no subscript [ ] notation allowed).


Write a C++ program that creates an integer array of a month and get the size of this array from the user. The program should take input values (temperatures for all days of the month) from the user. The program should display lowest temperature, highest temperature, and average temperature for the month. Important




Note: Please use pointer notation to access array elements (do not use array notation [ ])

Array size is 100

- gets the best score out of all the inputted grades and assigned grades based on the following scheme:

Grade is A if score is > = best - 10;

Grade is B if score is > = best - 20;

Grade is C if score is > = best - 30;

Grade is D if score is > = best - 40;

Grade is F otherwise.

Sample:

Enter the number of students: 4

Enter 4 scores: 40 55 70 58

Student 0 score is 40 and grade is C

Student 1 score is 55 and grade is B

Student 2 score is 70 and grade is A

Student 3 score is 58 and grade is B


Implement the following algorithm for the single source shortest path problem in a directed weighted graph. You must use a min-priority queue to implement Q in the pseudocode. For priority queue, you are allowed to use the priority queue provided by the STL library or your own implementation. You must take input from the user.

function dijkstra(G)
    for each v ∈ V
        d[V] = infinite
      d[s] = 0;S = ∅;Q =V;
     
    while Q IS NOT EMPTY
        U = ExtractMIN (Q);
        S = S ∪ {u};
        for each V ∈ u->ADJ[]
          if (d[v] > d[u]+w(u,v))
              d[v] = d[u]+w(u,v);
               p[v] = u;
    

Sample Input:

V E

u v weight(u,v)

… Src node

4 5

0 1 10

0 2 6

0 3 5

1 3 15

2 3 4

1

Sample Output

no path from 1 to 0

sp from 1 to 1: 1, length: 0

no path from 1 to 2

sp from 1 to 3: 1-->3, length: 15





LATEST TUTORIALS
APPROVED BY CLIENTS