ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 09 May 2017 My Price 11.00

CS111Fall 2016Kazumi SlottLab 9-3arraySwap

Hello all. This is my first time using array not too sure what's wrong with my code.  I have attached the assignment. 

 

#include

using namespace std;

 

int main();

{

const int SIZE = 10;

int ar[SIZE];

srand (time(0));

int element;

for (int i = 0; i {

element = rand()%100 + 1

array [i]= element;

for (int l = 0, r = size - 1; ; l ++, r _ _ )

 

}

 

return 0;

}

 

 

 

 

CS111Fall 2016Kazumi SlottLab 9-3arraySwap.cppPut all your code in main.0.Declare a constant called SIZE for the size of the array (10).1.Create an array with 10 slots (use SIZE).2.Fill the array with 10 random numbers between 1 and 100.3.Print the array.4.Reverse the contents of the array.Do not create a second array.Hints:Swap each pair from outside.Use 2 indices (l, r).for(int l = 0,r = SIZE – 1; ….; l??,r??)You need a variable to store one of the numbers you are swapping.l = 0swapr = SIZE -1Original1010052211953351122Reverse22151339511225100105.Print the array again.

Attachments:

Answers

(11)
Status NEW Posted 09 May 2017 08:05 AM My Price 11.00

-----------

Not Rated(0)