Prog2 - CSc 252 Program 2 Version 1.0 Program 2: Swapping...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSc 252 Program 2 Version 1.0 1 of 2 Program 2: Swapping Numbers Program due: Thursday, October 13th, 11:59p.m. Write a program, named prog2.s , that will swap adjacent values in an array of integers. The array will be named numbers . The memory location numValues will contain the count of the items in numbers . The program will: Print the integers in numbers, one to a line. Swap pairs of numbers. Specifically, swap the numbers in positions 0 and 1, 2 and 3, 4 and 5, 6 and 7, etc. Print the swapped integers, one to a line. Print the swapped integers backwards, one to a line. For example, given the following: .data numbers: .word 9 .word -17 .word 14 .word 29 .word -23 .word 8 numValues: .word 6 # Your code goes below this line Your program should print: The array contains: 9 -17 14 29 -23 8 The swapped array contains: -17 9 29 14 8 -23 The swapped array backwards: -23 8 14 29 9 -17 Note:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSc 252 Program 2 Version 1.0 2 of 2 If the number of integers is odd, the last element of the array will not be swapped. See
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/28/2012 for the course CSC 252 taught by Professor Moon during the Fall '11 term at University of Arizona- Tucson.

Page1 / 2

Prog2 - CSc 252 Program 2 Version 1.0 Program 2: Swapping...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online