结构体数组的初始化
来源:互联网 发布:数据库between and 编辑:程序博客网 时间:2024/05/20 18:42
结构体数组的初始化,在结构体中加一个构造函数,就可以很轻松的初始化了。要么就得用视图
stu1.stuName="Mary"的句子了,这样子很麻烦!
using System;
using System.Collections;
using System.Text;
using System.Collections;
using System.Text;
namespace MyArray
{
public struct student
{
public string stuName;
public string stuNumber;
public int stuScore;
public student(string stuName, string stuNumber, int stuScore)
{
this.stuName = stuName;
this.stuNumber = stuNumber;
this.stuScore = stuScore;
}
}
class Program
{
static void Main()
{
student[] stu1 = new student[2];
stu1[0] = new student("Tom", "0101001", 96);
stu1[1] = new student("Mary", "0101002", 88);
}
}
}
{
public struct student
{
public string stuName;
public string stuNumber;
public int stuScore;
public student(string stuName, string stuNumber, int stuScore)
{
this.stuName = stuName;
this.stuNumber = stuNumber;
this.stuScore = stuScore;
}
}
class Program
{
static void Main()
{
student[] stu1 = new student[2];
stu1[0] = new student("Tom", "0101001", 96);
stu1[1] = new student("Mary", "0101002", 88);
}
}
}
- 结构体数组的初始化
- 结构体数组初始化
- 结构体数组初始化
- 关于数组结构体的初始化
- 一种初始化结构体数组的方法
- 关于数组、结构体的初始化
- 数组,结构体初始化 {0}
- 数组,结构体初始化 {0}
- 爬爬爬之路:结构体的初始化及结构体数组的初始化
- 关于结构体数组初始化的问题--深入举例
- 一个题目,涉及结构体数组的初始化与输出
- 结构体数组的指针初始化与内存释放
- C++程序设计语言练习5.7 结构体数组的初始化
- Linux中数组与结构体的快捷初始化
- 结构体的初始化
- 结构体的初始化
- 结构体的初始化
- 结构体的初始化
- 应用程序性能测试的艺术(连载)第2章有效应用系统性能测试的基本原则01
- 五个比较实用的CSS属性,网页设计时很多时候都使用到。
- 拷贝构造函数_2
- 素数判断算法(高效率)
- HDU 1254 推箱子
- 结构体数组的初始化
- 中断模块示例
- cognos
- 整理个人实现的Ftp服务器、Web Ftp服务器、Mini Http服务器
- JS调用问题
- SVN学习*(简易搭建)
- vim 生成html 高亮
- HDU 1732 push Box
- classloader.getresources() 介绍