阵列? [英] Arrays?
问题描述
我正在为作业编写一个C ++程序。
创建一个C ++程序来管理10个银行账户......
包含;
适当的类型定义,用于存储姓名,账号和
银行账户余额
用于记录10个银行账户详细信息的数组
更新/查询银行账户数组的功能/程序。
我拥有一个银行账户的所有代码,你可以在这里用dedt /
来支付余额和余额,但是,我不是很好确定数组以及
如何访问它们,所以我的想法是这样的:
浮动账户[2] [10];
//帐户munber on [0] [x]
account [0] [0] = 10001;
account [0] [1] = 10002;
account [0] [2] = 10003;
account [0] [3] = 10004;
account [0 ] [4] = 10005;
account [0] [5] = 10006;
acco unt [0] [6] = 10007;
account [0] [7] = 10008;
account [0] [8] = 10009;
account [0] [9] = 10010;
//帐户余额[1] [x]
帐户[1] [0] = 0;
account [1] [1] = 0;
account [1] [2] = 0;
account [1] [3] = 0;
account [1] [4] = 0;
account [1] [5] = 0;
account [1] [6] = 0;
account [1] [7] = 0;
account [1] [8] = 0;
帐户[1] [9] = 0;
但我不知道如何包含名称,或者我将如何开始
"插入帐号"并获取此信息。
Hi,
I''m currently writing a C++ program for an assignment.
"Create a C++ program to manage 10 bank accounts... "
To include;
"An appropriate type definition to store the name, account number and
balance of a bank account
An array to record the details of the 10 bank accounts
Functions/procedures to update/interrogate the bank accounts array."
I have all the code for a single bank account where you can depost/
withdaw and vew balance, but, I?m not quite sure about arrays and how
to access them, so my idea was this:
float account [2][10];
// account munber on [0][x]
account[0][0] = 10001;
account[0][1] = 10002;
account[0][2] = 10003;
account[0][3] = 10004;
account[0][4] = 10005;
account[0][5] = 10006;
account[0][6] = 10007;
account[0][7] = 10008;
account[0][8] = 10009;
account[0][9] = 10010;
// account balance on [1][x]
account[1][0] = 0;
account[1][1] = 0;
account[1][2] = 0;
account[1][3] = 0;
account[1][4] = 0;
account[1][5] = 0;
account[1][6] = 0;
account[1][7] = 0;
account[1][8] = 0;
account[1][9] = 0;
But I have no idea how to include a name, or how I would start with
"insert account number" and get this to pull details.
推荐答案
gb ** @ hotmail.co.uk 写道:
我正在编写一个C ++程序对于作业。
创建一个C ++程序来管理10个银行账户......
要包含;
"适当的类型定义,用于存储名称,帐号和
银行帐户余额
用于记录详细信息的数组10个银行账户中的数据
更新/询问银行账户数组的功能/程序。
我拥有单个银行账户的所有代码你可以使用dd和vew balance来发布/
,但是,我不太确定数组以及
如何访问它们,所以我的想法是:
浮动账户[2] [10];
//账户munber on [0] [x]
账户[0] [0] = 10001;
account [0] [1] = 10002;
account [0] [2] = 10003;
account [0] [3] = 10004;
account [0] [4] = 10005;
account [0] [5] = 10006;
account [0] [6] = 10007;
account [0] [7] = 10008;
account [0] [8] = 10009;
account [0] [9] = 10010;
//帐户余额[1] [x]
帐户[1] [0] = 0;
account [1] [1] = 0;
account [1] [2] = 0;
account [1] [3] = 0;
account [1] [4] = 0;
account [1] [5] = 0;
account [1] [6] = 0;
account [1] [7] = 0;
account [1] [8] = 0;
帐户[1] [9] = 0;
但我不知道如何包含名称,或者我将如何开始
"插入帐号"并得到这个拉细节。
Hi,
I''m currently writing a C++ program for an assignment.
"Create a C++ program to manage 10 bank accounts... "
To include;
"An appropriate type definition to store the name, account number and
balance of a bank account
An array to record the details of the 10 bank accounts
Functions/procedures to update/interrogate the bank accounts array."
I have all the code for a single bank account where you can depost/
withdaw and vew balance, but, I?m not quite sure about arrays and how
to access them, so my idea was this:
float account [2][10];
// account munber on [0][x]
account[0][0] = 10001;
account[0][1] = 10002;
account[0][2] = 10003;
account[0][3] = 10004;
account[0][4] = 10005;
account[0][5] = 10006;
account[0][6] = 10007;
account[0][7] = 10008;
account[0][8] = 10009;
account[0][9] = 10010;
// account balance on [1][x]
account[1][0] = 0;
account[1][1] = 0;
account[1][2] = 0;
account[1][3] = 0;
account[1][4] = 0;
account[1][5] = 0;
account[1][6] = 0;
account[1][7] = 0;
account[1][8] = 0;
account[1][9] = 0;
But I have no idea how to include a name, or how I would start with
"insert account number" and get this to pull details.
考虑定义一个新的*类型*,它将所有这些信息存储在
一个地方中。类似
struct Account {
浮动余额; //如果你认为''float''是正确的类型
std :: string owner; //
无符号数; //
};
或者你没有超过用户定义的类型?
V
-
请在通过电子邮件回复时删除资金''A'
我不回复热门回复,请不要问
Consider defining a new *type* that would store all this information in
"one place". Something like
struct Account {
float balance; // if you think that ''float'' is the right type
std::string owner; //
unsigned number; //
};
Or have you not gone over user-defined types?
V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask
5月27日下午2:46,Victor Bazarov< v.Abaza ... @ comAcast.netwrote:
On May 27, 2:46 pm, Victor Bazarov <v.Abaza...@comAcast.netwrote:
g ... @ hotmail.co.uk写道:
g...@hotmail.co.uk wrote:
Hi,
我正在为作业编写一个C ++程序。
I''m currently writing a C++ program for an assignment.
"创建一个C ++程序来管理10个银行账户......
"Create a C++ program to manage 10 bank accounts... "
包含;
To include;
"适当的类型定义,用于存储银行帐户的名称,帐号和
余额>
用于记录10个银行账户详细信息的数组
更新/询问银行账户数组的功能/程序。
"An appropriate type definition to store the name, account number and
balance of a bank account
An array to record the details of the 10 bank accounts
Functions/procedures to update/interrogate the bank accounts array."
我有一个单一银行账户的所有代码,你可以用ddt和vew余额来支付
,但是,我不太确定数组以及
如何访问它们,所以我的想法是:
I have all the code for a single bank account where you can depost/
withdaw and vew balance, but, I?m not quite sure about arrays and how
to access them, so my idea was this:
浮动帐户[2] [10];
float account [2][10];
//帐户munber on [0] [x]
account [0] [0] = 10001;
account [0] [1] = 10002;
account [0] [2] = 10003;
account [0] [3] = 10004;
account [0] [4] = 10005;
account [0] [5] = 10006;
account [0 ] [6] = 10007;
account [0] [7] = 10008;
account [0] [8] = 10009;
account [0] [9] = 10010;
// account munber on [0][x]
account[0][0] = 10001;
account[0][1] = 10002;
account[0][2] = 10003;
account[0][3] = 10004;
account[0][4] = 10005;
account[0][5] = 10006;
account[0][6] = 10007;
account[0][7] = 10008;
account[0][8] = 10009;
account[0][9] = 10010;
// [1]上的账户余额[x]
// account balance on [1][x]
账户[1] [0] = 0;
账户[1] [1] = 0;
账户[1] [2] = 0;
account [1] [3] = 0;
account [1] [4] = 0;
account [1] [5] = 0 ;
账户[1] [6] = 0;
账户[1] [7] = 0;
账户[1] [ 8] = 0;
account [1] [9] = 0;
account[1][0] = 0;
account[1][1] = 0;
account[1][2] = 0;
account[1][3] = 0;
account[1][4] = 0;
account[1][5] = 0;
account[1][6] = 0;
account[1][7] = 0;
account[1][8] = 0;
account[1][9] = 0;
但我不知道如何包含名称,或者我将如何开始使用
" insert account number" ;并得到这个拉细节。
But I have no idea how to include a name, or how I would start with
"insert account number" and get this to pull details.
考虑定义一个新的*类型*,它将所有这些信息存储在
一个地方中。类似
struct Account {
浮动余额; //如果你认为''float''是正确的类型
std :: string owner; //
无符号数; //
};
或者你没有超过用户定义的类型?
V
-
请在通过电子邮件回复时删除资金''A'
我不回复热门回复,请不要问
Consider defining a new *type* that would store all this information in
"one place". Something like
struct Account {
float balance; // if you think that ''float'' is the right type
std::string owner; //
unsigned number; //
};
Or have you not gone over user-defined types?
V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask
据我所知:/
已在作业简报中指定了数组
Not to my knowledge :/
Arrays have been specified in the assignment brief
甚至某些指向某些在线阅读材料的方向将与
相关,我们将非常感激。
不寻找具体细节只是一些微妙的指导:)
even some direction to some online reading materials which would be
relevant to this would be more than appreciated.
not looking for specifics just some subtle guidance :)
这篇关于阵列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!