Write a program and flowchart. The program should store the ages of six of your friends in an array. Store each of the six ages using the assignment operator. Print the ages on-screen using a "for" loop.
Screenshot of the code:
Sample Output:
Code to copy:
//Include required header file.
#include <iostream>
//Use the standard naming convention.
using namespace std;
//Start the main() method.
int main()
{
//Create an integer array of size 6.
int ages[6];
int i;
//Initialize each element of the array using assignment
//operator.
ages[0] = 21;
ages[1] = 22;
ages[2] = 23;
ages[3] = 24;
ages[4] = 25;
ages[5] = 26;
//Display the ages of 6 friends.
cout << "Age of all 6 friends:" << endl;
//Traverse the array of size 6 using a for loop.
for(i = 0; i < 6; i++)
{
//Display age of each friend.
cout << "Friend " << (i + 1) << " age: " << ages[i];
cout << endl;
}
}
Sample Flow chart:
Write a program and flowchart. The program should store the ages of six of your friends...
Pointer tasks: ( In C++ ) 1. Write a program to store the address of a character variable and a float variable. • Print the address of both variables. • Print the values of variable using dereference operator. • Add 2 in float value using pointer. • Print address of character variable using reference operator. 2. Write a program that takes 5 elements in an array and print them in reverse order using pointers. 3. Write to program that takes...
Write a C program to store the first name, the age and the exam mark of 5 students by using an array of structures. Print the information stored in the structure array on the screen
question 2 in C programming please PE-05b-01 (Six-sider) write a counter-controlled program that prompts the user to enter the number of times n to roll a six-sided die. The program should print to the screen the iteration of the loop and result for each roll 1 ) How many times would you like to roll? 3 roll 6 6 5 1 2) PE 05b 02 (Flash Cards) Write a counter-controlled program that creates addition problems for an elementary kid to...
Draw flowchart AND write pseudo code The retail store wants a program that will print out the profit for the day. They will enter how much money in the drawer at the end of each day along with the total amount spent for business costs. The difference is the profit.
Design a program using a RAPTOR flowchart that has two parallel arrays: a String array named people that is initialized with the names of twenty of your friends, and a String array named phoneNumbers that is initialized with your friends’ phone numbers. The program should allow the user to enter a person’s name. It should then search for that person in the people array. If the person is found, it should get that person’s phone number from the phoneNumbers array...
Write a C program Design a program that uses an array to store 10 randomly generated integer numbers in the range from 1 to 50. The program should first generate random numbers and save these numbers into the array. It will then provide the following menu options to the user: Display 10 random numbers stored in the array Compute and display the largest number in the array Compute and display the average value of all numbers Exit The options 2...
Write a program that performs the following operations on a one dimensional array with 50 unsigned integers. The main program will initialize the array, print the array values to the screen and then call a function that will determine and print the maximum and minimum values. •Declare the array and any other variables. •Use a loop to initialize the array with 50 random integer values between 0 and 99 using the rand() function. (number = rand() % 100;) •Using cout...
Can someone help me with these C program problems? Thanks 1. Write a C program that creates two arrays of integers, one on the stack and one on the heap. You will loop through these arrays and populate them with values (any value is fine). You will then loop through these arrays again and print each value. Your output should look something like “Value in index 1 is 100 from stack array and 100 from heap array.” Do not forget...
Create a program that allows a user to enter up to five names of friends. Use a twodimensional array to store the friends’ names. After each name is entered, the user should have the option to enter another name or print out a report that shows each name entered thus far
Write a program that creates an array of 10 integers. The array should be populated with values: each element should be equal to its subscript/index. The program should then print each element. Make use of a loop in storing values to the array. Make use of another loop in printing the values of the array.