using System;
namespace Project6Chap7
{
class Arrays
{
static void Main( )
{
int[] aNum = new int[1000];
int[] i = new int[1000];
string inValue;
int aNumCount = 0;
int total = 0;
Console.Write("Enter a number 1 to 100: "
+ "(or -99 to exit)", aNumCount + 1);
inValue = Console.ReadLine();
while(inValue != "-99")
{
aNum[aNumCount] = Convert.ToInt32(inValue);
++aNumCount;
Console.WriteLine("Enter a number 1 to 100: "
+ "(or -99 to exit)", aNumCount + 1);
inValue = Console.ReadLine( );
}
foreach (int val in aNum)
{
total += val;
}
Console.WriteLine("Total: " + total);
Console.WriteLine("The first value entered was: " + i);
}
}
}
it runs fine so far but my question is how do I call the first number entered. I have tried several different ways but I either get -1 or ToInt32
Please help me
This post has been edited by Martyr2: 15 November 2012 - 11:29 PM
Reason for edit:: Fixed code tags. [code]code in here[/code]. Thanks! :)

New Topic/Question
Reply



MultiQuote




|