Digital FXtbook
Easy Contacts
  • Home
    • Free Software
    • The Author
    • Former Students Hall of Fame
    • A tribute....
  • Gaming
    • Board Game Game Design Document
    • Modeling >
      • Introduction: The Temple
      • Minecraft Steve
      • Minecraft Tools and Weapons
      • Roblox Character modeling
      • Sword of Light
      • Buzz Axe
      • Halo 1 Blood Gulch Base
      • Hammer
      • Sword
      • Character Modeling Big Daddy
      • Shield
      • The OM6G
      • Weapon
      • Character Modeling Legion the Geth
      • Character Modeling Geth Armor
    • Animation >
      • Character Animation
    • Rigging >
      • Rigging with HumanIK
      • Characterizing and MoCap
      • Integration with Unity
    • Unity >
      • Terrain
      • Importing Models
  • Coding
    • Beginning C# >
      • First Unit >
        • First Program
        • Comments >
          • PsuedoCode
        • Variable Types >
          • AlphaNumeric Variables
          • Numeric Variables
        • Getting input from the user
        • Try and Catch
        • Operators >
          • Assignment Operators >
            • Zeller's Congruence
            • Leap Year
          • Comparison Operators >
            • Logical Data, Illogical Assignment
          • Arithmetic Operators >
            • Use of Parenthesis
            • Algebra in code and assundry CHAOS
            • Pre and Post Operators
            • Shortcut Operators
            • Floats Conversion from Metric to English
            • When is Easter??
          • Logical Operators
        • Casting
      • Second Unit >
        • Conditional Statements >
          • Number validator
          • Number tester
          • Speed Camera
        • Random Class
        • Arrays >
          • Simple Arrays
          • Complex Arrays
        • Loops >
          • For Loops >
            • Adding Numbers
          • For Each Loops
          • While Loops
          • Do While Loops
      • Third Unit
    • Intermediate C# >
      • Object Oriented Programming
    • Unity Coding >
      • Introduction Unity Lesson
      • Number Wizard Game #1
      • Second Unity Game: Text Adventure
      • Number Wizard Game GUI
      • Block Breaker >
        • Block Breaker Game #1
        • Block Breaker Game #2
        • Block Breaker Game #3
        • Block Breaker Game #4
    • Linda Training >
      • What is C#?
      • Working with Classes
  • Student Films
    • Advanced Student's movies
    • Beginning Student's movies
  • Adobe
    • Photoshop >
      • Introduction
      • Selection Tools >
        • Melonhead >
          • Melonhead Creative
        • Breakfast Lunch or Dinner
        • Blu 42
      • Painting Tools >
        • Invisi-World
        • Image Adjustment
        • FreeStyle project
      • Drawing Tools >
        • Abstract Expressionism
    • Premier >
      • Linda Training Intro
      • Basic Editing
      • Editing Refinement
    • Illustrator >
      • Vector Ninjas
      • Live Art Painting
      • Starting the Pen Tool
      • Apple and Pear
      • Creating Your LOGO
      • Self Portrait
  • Com Apps
    • Com Apps page 1
    • Com Apps page 2
    • Com Apps page 3
    • Com Apps page 4
  • Links
    • Distance Reconnecting
    • Key Board Fix/Hack
    • Buiding Piers >
      • Buiding Piers
      • Buiding Piers
    • The Top Six Animation Schools
    • The Top Video Game Design Schools
    • Contests >
      • International Team

Complex Arrays

In this section you are going to learn about more complex arrays other than single arrays.

You are going to learn about 2 dimensional rectangular arrays and Jagged arrays.


Assignment

In this assignment you will begin to manipulate arrayed variables.

Take a look at the code below - it declares two equally sized vectors.
The former is initialized, the latter isn't.

We want the second vector to store the same values as the first one, but in a different order: imagine that all the values have been moved one cell to the right, while the last element has gone to the first position.

We can say that the vector has been rotated to the right. Warning: you must use the for loop for it. Don't use single assignments - they may work but they'll reflect badly on you and on your programming skills.

Here is an example of some code to help you brain juices to start flowing

int variable1 = 1, variable2 = 2, auxiliary;
auxiliary = variable1;
variable1 = variable2;
variable2 = auxiliary; 


The code above moves the value of variable1 into the variable auxiliary first, then moves variable2 into variable1, then lastly auxiliary gets moved into variable2. Auxiliary only serves as a temporary place for a value while everything else is switched around

Here is some more code

for(int i = 0; i < 2; i++)
     {
          auxiliary = numbers[i];
          numbers[i] = numbers[4 – i];
          numbers[4 – i] = auxiliary;
     }


​The code above basically does the same thing as before except it is wrapped into a for loop that will continue to work until the condition i<2 proves false. Inside of the for the loop we start off with setting i=0. i simply serves as our counter and this actions is only done once. The end of each loop is i++ and this will increment our counter every time the loop is executed.

Sooo the loop will happened 2 times (i starts off at 0, the loop runs, and i is incremented to 1, the loops runs, and i gets incremented again to 2, we exit the loop this time because i<2 is no longer true


​

Initial code


using System;

class forLoopArray
{
    public static void Main()
    {
        var vectorFirst = new int[7] { 4, 7, 2, 8, 1, 3, 0 };
        var vectorSecond = new int[7];

        for (int i = 0; i < 7; i++)
        {
            // insert your code here
            Console.WriteLine(vectorSecond[i]);
        }
    }



}

Example results

​0 4 7 2 8 1 3
Proudly powered by Weebly