Answer:
- #include <iostream>
- using namespace std;
- int main()
- {
- // declare and initialize popcorn name array
- string popcorn_name[7] = {"plain", "butter", "caramel", "cheese", "chocolate", "turtle", "zebra"};
- // declare and initialize sales array with 7 elements
- int sales[7];
-
- // A loop to prompt user to enter sales for each popcorn
- for(int i=0; i < 7; i++){
- cout<<"Enter number of sales for " + popcorn_name[i] + " :";
- cin>>sales[i];
- }
-
- // Find maximum sales
- int max = sales[0];
- int maxIndex = 0;
- for(int j=1; j < 7; j++){
- if(max < sales[j]){
- max = sales[j];
- maxIndex = j;
- }
- }
-
- // Find minimum sales
- int min = sales[0];
- int minIndex = 0;
- for(int k=1; k < 7; k++){
- if(min > sales[k]){
- min = sales[k];
- minIndex = k;
- }
- }
-
- // Print popcorn name and sales
- for(int l=0; l < 7 ; l++){
- cout<<popcorn_name[l]<<"\n";
- cout<<"Sales: "<< sales[l]<<"\n\n";
- }
-
- // Print popcorn name with maximum and minimum sales
- cout<<"Highest selling: "<< popcorn_name[maxIndex]<<"\n";
- cout<<"Lowest selling: "<<popcorn_name[minIndex]<<"\n";
- return 0;
- }
Explanation:
Create two arrays to hold the list of popcorn name and their sales (Line 5-8). Next prompt user to input the sales for each popcorn (Line 10-14). Get the maximum sales of the popcorn (Line 17-24) and minimum sales (Line 27-34). Print the popcorn name and sales (Line 37-40) and the popcorn name with highest and lowest selling (Line 43-44).
There are many different ways you can learn how to code, You can use free and paid online courses, Youtube Videos, and Trial and Error. Programming does not come easy and you have to be patient with yourself. Its like learning to drive for the first time, its a little rough but you eventually will catch on and be able to understand what you are doing!
1.) There are many websites that will help teach you different languages like Java, JS, C#, Python, Ruby, Html5, etc.
Here are a few of my favorite websites that helped me.
Code Academy: https://www.codecademy.com/
Khan Academy: <span>https://www.khanacademy.org/
</span>W3Schools (Html Only, Not a Course just useful) http://www.w3schools.com/
I suggest going through those websites, or finding some other websites out there that will help you!
2.) Youtube Videos are perfect for learning specific things in programming! You can learn how to make a calculator, or a website, or anything you'd like! Just simply search for a how-to tutorial and watch the helpful videos! Remember, don't just copy the code.. try and understand it
3.) Trial and Error is one of the best ways you can teach yourself code. It was the best way for me to learn. Everyone learns from their mistakes and you should always try and come up with new things.
Be patient, and enjoy what you are doing! I also suggest working on one language at a time, don't try and learn two or more languages at the same time! Good luck :) Email me at any time if you need any help!
Answer: c.)
Explanation:
The bit SYN is used in order to synchronize segment numbers in the sender and receiving processes in hosts that are trying to start a data transmitting session between them.
It is initiated by the sending end, that set this bit to " 1", in the TCP header, starting which is known as a "3-way handshake process".
The bit SYN is not used in order to close a connection, the FIN bit is used for this purpose.
If one process set the FIN bit to "1", this means that it has no more data to send.
Answer:
Sure, what do you need help with
Explanation: