Question

C++ Visual Studio Program must, Accept a unknown amount of intergers Use vectors Print to screen...

C++ Visual Studio
Program must,

Accept a unknown amount of intergers
Use vectors
Print to screen the index-order
Print to screen the reverse index-order

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>
#include<vector>

using namespace std;

int main()
{
vector<int> v1;
int numInts;
int num,i;

cout<<"Enter number of integers : ";
cin>>numInts;

cout<<endl;

for(i=0;i<numInts;i++)
{
cout<<"Enter integer at "<<i<<" : ";
cin>>num;
v1.push_back(num);
}

cout<<endl<<endl;
cout<<"Printing to screen the index-order : "<<endl<<endl;

for(i=0;i<v1.size();i++)
{
cout<<v1[i]<<"\t";
}

cout<<endl<<endl;
cout<<"Printing to screen the reverse index-order : "<<endl<<endl;

for(i=v1.size()-1;i>=0;i--)
{
cout<<v1[i]<<"\t";
}

cout<<endl<<endl;
system("pause");
return 0;
}

t CAUserslusenDesktopCheggppiVectorDebugVector exe Enter number of integers5 Enter integer ate:1e Enter integer at 1: 20 Ente

Add a comment
Know the answer?
Add Answer to:
C++ Visual Studio Program must, Accept a unknown amount of intergers Use vectors Print to screen...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please create the following program in C format with Visual Studio Declare any variables needed Print...

    Please create the following program in C format with Visual Studio Declare any variables needed Print “Hello my name is (add your name here)” onto the screen. Ask the user for a number. Scan the number from the user. Multiply the number by 123. Print the original number and the product back onto the screen. Ask the user for a letter. Scan the letter from the user. Make an uppercase and a lowercase version of the letter (use toupper and...

  • Program must be in C language and MUST be able to run on visual studio 2....

    Program must be in C language and MUST be able to run on visual studio 2. Using Pointers and Arrays 2.1 Write a function bubblesort which will accept an array of double precision floating point numbers of length N and sort the array. Ref: https://en.wikipedia.org/wiki/Bubble_sort (I can verify this is accurate) 2.2 Write a program which exercises the bubblesort. For a good test, the program should have more than 20 values.

  • Must be done in C++ 2013 microsoft visual studio Write a program that creates a 4...

    Must be done in C++ 2013 microsoft visual studio Write a program that creates a 4 x 5 two-dimensional array. The program should use loops to populate the array using the rand, srand and time functions with random numbers between 10 and 60. After the values have populated the array, output the values of the array to the screen in something that looks like a 4 x 5 table.

  • Done in C++ using visual studio 1. Write a program with one additional function called int[]...

    Done in C++ using visual studio 1. Write a program with one additional function called int[] reverseArray(int array). This function will receive an array from main and then reverse and should return the reversed array to the main to print out. Use a single array and a single loop, you’re are neither allowed to print out just in reverse order nor allowed to use another array variable to store the original array in reverse order. 2. Write a program which...

  • Use C++ and Visual Studio Word Finder Version Your version of word finder should allow players...

    Use C++ and Visual Studio Word Finder Version Your version of word finder should allow players to find as many words as they can from the list of letters. Name the cpp file called wordFinder LastNameFirstName.cpp. Words must contain at least 3 letters but no more than 6 letters The program must first read the words from a file but only can read in at most 5 words from a text file. The program should skip words that contains less...

  • Using assembly language in microwoft visual studio write the following code with procedure with c...

    using assembly language in microwoft visual studio write the following code with procedure with correct number of Fib numbers Your program should detect the largest Fib number that can be calculated. Besides storing the result in an array, print them on the screen.

  • C++ and Using Microsoft Visual Studio. Write 2 programs: One program will use a structure to...

    C++ and Using Microsoft Visual Studio. Write 2 programs: One program will use a structure to store the following data on a company division: Division Name (East, West, North, and South) Quarter (1, 2, 3, or 4) Quarterly Sales The user should be asked for the four quarters' sales figures for the East, West, North, and South divisions. The data for each quarter for each division should be written to a file. The second program will read the data written...

  • Use C++, visual studio format. Please Write a program to solve the quadratic equation and find...

    Use C++, visual studio format. Please Write a program to solve the quadratic equation and find only the real and equal roots. the program should test for three types of roots tell the users the roots type and then calculate the real roots. the user enters the values of a ,b and c. you calculate r1 and r2. c

  • THIS MUST BE DONE ON VISUAL STUDIO Write a C# program that computes a the cost...

    THIS MUST BE DONE ON VISUAL STUDIO Write a C# program that computes a the cost of donuts at your local Rich Horton’s store. The cost, of course, depends on the number of donuts you purchase. The following table gives the break down: Donuts Purchased Cost per Donut ($) = 15 0.75 A customer can save on the HST (13%) if they buy 12 or more donuts so only charge HST (use a constant) on the purchase if the customer...

  • answer the following using C# Design and program a Visual Studio Console project in C# that...

    answer the following using C# Design and program a Visual Studio Console project in C# that allows your user to enter a number. The program will examine the number to see if it is prime. If it is prime, it will print the next higher prime and the next lower primes to the console. If the number entered by the user is not prime, display a message to that effect. All code should be written by you. Do not copy/paste...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT