Initial commit
This commit is contained in:
10
ConsoleApp4/ConsoleApp4.csproj
Normal file
10
ConsoleApp4/ConsoleApp4.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
25
ConsoleApp4/ConsoleApp4.sln
Normal file
25
ConsoleApp4/ConsoleApp4.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36518.9 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp4", "ConsoleApp4.csproj", "{39F1C705-82C1-47BA-9300-27AD2CAC80CB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{39F1C705-82C1-47BA-9300-27AD2CAC80CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{39F1C705-82C1-47BA-9300-27AD2CAC80CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{39F1C705-82C1-47BA-9300-27AD2CAC80CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{39F1C705-82C1-47BA-9300-27AD2CAC80CB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {B9781DF7-01FC-404C-9946-2CB8FC2DBEB9}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
16
ConsoleApp4/Program.cs
Normal file
16
ConsoleApp4/Program.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
//namespace ConsoleApp4
|
||||
//{
|
||||
// internal class Program
|
||||
// {
|
||||
// static void Main(string[] args)
|
||||
// {
|
||||
// int[] myarry = new int[3] { 10, 20, 30 };
|
||||
// Console.WriteLine(myarry);
|
||||
// foreach (int item in myarry)
|
||||
// {
|
||||
// Console.Write(item + " ");
|
||||
// }
|
||||
// Console.ReadLine();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
60
ConsoleApp4/p2.cs
Normal file
60
ConsoleApp4/p2.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
|
||||
namespace ConsoleApp4
|
||||
{
|
||||
public class p2
|
||||
{
|
||||
public static void Displaymatrix(int[,] A)
|
||||
{
|
||||
for (int i = 0; i < A.GetLength(0); i++)
|
||||
{
|
||||
for (int j = 0; j < A.GetLength(1); j++)
|
||||
{
|
||||
Console.Write("{0,6}", A[i, j]);
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
static void Main()
|
||||
{
|
||||
int i, j, sum = 0, t;
|
||||
int[,] A = new int[4, 4];
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
A[i, j] = i * 4 + j + 1;
|
||||
}
|
||||
}
|
||||
Console.WriteLine("原始矩阵:"); Displaymatrix(A);
|
||||
Console.WriteLine("上三角矩阵:");
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for (int k = 0; k < i * 7; k++) Console.Write(" ");
|
||||
for (j = i; j < 4; j++) Console.Write("{0,6} ", A[i, j]);
|
||||
Console.WriteLine();
|
||||
}
|
||||
Console.WriteLine("下三角矩阵");
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for (j = 0; j < i+1; j++) Console.Write("{0,6}", A[i, j]);
|
||||
Console.WriteLine();
|
||||
}
|
||||
Console.WriteLine("两条对角线之和");
|
||||
for (i = 0; i < 4; i++) sum += A[i, i] + A[i, 3 - i];
|
||||
Console.WriteLine("{0,6}", sum);
|
||||
Console.WriteLine("矩阵A转置:");
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for (j = i; j < 4; j++)
|
||||
{
|
||||
t = A[i, j];
|
||||
A[i, j] = A[j, i];
|
||||
A[j, i] = t;
|
||||
}
|
||||
}
|
||||
Displaymatrix(A);
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
ConsoleApp4/p3.cs
Normal file
12
ConsoleApp4/p3.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConsoleApp4
|
||||
{
|
||||
internal class p3
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user