Hi every one,
Could you give met the sample code how to program these ...
All what I want to do are :
load the array from text file for example :
3
56
234
12
167
123
26
84
For the reply. I'm very appreciate..
Thanks
Hi every one,
Could you give met the sample code how to program these ...
All what I want to do are :
load the array from text file for example :
3
56
234
12
167
123
26
84
For the reply. I'm very appreciate..
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Karthik AgarwalPosted Nov 25, 2011, 4:16 AM
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace interest_calculation
{
class Program
{
static void Main(string[] args)
{
while (true)
{
int no_of_elements;
Console.Write("\nHow many elements you want to enter : ");
no_of_elements = Convert.ToInt32(Console.ReadLine());
int[] elements;
elements = new int[no_of_elements];
for ( int i = 0; i < no_of_elements; i++ )
{
Console.Write("\nPlease enter the element {0} : ", i + 1);
elements[i] = Convert.ToInt32(Console.ReadLine());
}
Console.Write("\nHow many rows you want : ");
int rows = Convert.ToInt32(Console.ReadLine());
Console.Write("\nHow many columns you want : ");
int columns = Convert.ToInt32(Console.ReadLine());
if(rows < columns)
{
rows = columns;
}
else if (rows > columns)
{
columns = rows;
}
else
{
//do nothing
}
Console.WriteLine("Your data is : ");
Console.WriteLine();
for (int j = 0; j < rows; j++)
{
Console.Write(elements[j] + "\t");
}
Console.WriteLine();
for (int k = rows; k < (columns + rows); k++)
{
Console.Write(elements[k] +"\t");
}
Console.WriteLine();
}
}
}
}
i did it in console application convert that to windows forms or what ever it is.
I also didn't understand the last part of your question asking to convert to 2x4 to 4x8.
If you can explain that part in more detail i can do that one as well. You also didn't mention what kind of application it is windows forms or console or something else. Also you didn't mention how you will be giving input conversion from 2x4 to 4x8 or something like that. Will you get 8 inputs every time and want to convert that to 2x4 and from that to 4x8 is this format fixed or else you want the user to be popped up for the number of elements he want to convert and what kind of matrix he need. If you can answer all these things i am ready to provide you more efficient code.
lina linaPosted Nov 29, 2011, 3:19 AM