473,325 Members | 2,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Array that will store answers to questions

10
i have got to create an array which will stored the answers to my questions any idea on how to do this
Dec 6 '06 #1
9 1246
willakawill
1,646 1GB
i have got to create an array which will stored the answers to my questions any idea on how to do this
Hi. Not enough information
What data type will your answers be?
How many answers do you need to store?
Dec 6 '06 #2
amie857
10
i have got to store ten answers. i am making a maths application and everytime they answer a question the question and answer needs to be stored and then produced on the answer page
Dec 6 '06 #3
willakawill
1,646 1GB
i have got to store ten answers. i am making a maths application and everytime they answer a question the question and answer needs to be stored and then produced on the answer page
and what type of data is the answer? is it an integer, float, string?
Dec 6 '06 #4
amie857
10
interger. you have to add a and b together to create the maths results
Dec 6 '06 #5
willakawill
1,646 1GB
interger. you have to add a and b together to create the maths results
ok. here is a code snippet that will help you on your way

Expand|Select|Wrap|Line Numbers
  1. int a;
  2. int b;
  3. int result[10];
  4. for (int i = 0; i < 10; i++) {
  5.    cout << "Input the first number for sum " << i + 1;
  6.    cin >> a;
  7.    cout << "Input the second number for sum " << i + 1;
  8.    cin >> b;
  9.    result[i] = a + b;
  10. }
Dec 6 '06 #6
Killer42
8,435 Expert 8TB
ok. here is a code snippet that will help you on your way

Expand|Select|Wrap|Line Numbers
  1. int a;
  2. int b;
  3. int result[10];
  4. for (int i = 0; i < 10; i++) {
  5.    cout << "Input the first number for sum " << i + 1;
  6.    cin >> a;
  7.    cout << "Input the second number for sum " << i + 1;
  8.    cin >> b;
  9.    result[i] = a + b;
  10. }
Will that really help much in the VB forum? Looks like Java, to me. Here's a quick attempt at a VB6 translation. For VB.Net, don't ask me. :)
Expand|Select|Wrap|Line Numbers
  1. Dim a As Integer
  2. Dim b As Integer
  3. Dim result(1 To 10) As Integer
  4. For i = 1 To 10
  5.   a = Cint(InputBox("Input the first number for sum" & i))
  6.   b = Cint(InputBox("Input the second number for sum" & i))
  7.   result(i) = a + b
  8. Next
P.S. This was just done on the fly in the editor here, so may need some debugging.
Dec 6 '06 #7
willakawill
1,646 1GB
Will that really help much in the VB forum? Looks like Java, to me.
Oops. glad someone is cleaning up after me. I thought I was answering a c++ question.
Dec 7 '06 #8
Killer42
8,435 Expert 8TB
Oops. glad someone is cleaning up after me. I thought I was answering a c++ question.
Well, I supose not knowing c++, it's simpler for me. I just read the message and if my reaction is "what the bleep does that mean?" then something's wrong (hopefully with the post, and not me). :)
Dec 7 '06 #9
willakawill
1,646 1GB
Well, I supose not knowing c++, it's simpler for me. I just read the message and if my reaction is "what the bleep does that mean?" then something's wrong (hopefully with the post, and not me). :)
Well that's me, jack of all trades, master of none :)
Dec 7 '06 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Geoff Cox | last post by:
Hello, I have a series of pages each of which creates an array of values. How do I keep all the array values until the last page? Cheers Geoff
22
by: Wynand Winterbach | last post by:
I think every C programmer can relate to the frustrations that malloc allocated arrays bring. In particular, I've always found the fact that the size of an array must be stored separately to be a...
12
by: arkobose | last post by:
my earlier post titled: "How to input strings of any lengths into arrays of type: char *array ?" seems to have created a confusion. therefore i paraphrase my problem below. consider the...
5
by: Sukh | last post by:
I have to design a "Online Test Application" and application is going to display question and answers.All the questons are objective type so there is four answer for each question. My Question is...
3
by: Sukh | last post by:
I have to design a "Online Test Application" and application is going to display question and answers.All the questons are objective type so there is four answer for each question. My Question is...
8
by: redefined.horizons | last post by:
I would like to have an array declaration where the size of the array is dependent on a variable. Something like this: /* Store the desired size of the array in a variable named "array_size". */...
8
by: per9000 | last post by:
Hi all, I have a two-dimensional array of data, f.x int's. We can imagine that the array is "really large". Now I want the data in it and store this in a one-dimensional array. The obvious...
7
by: alternative451 | last post by:
Hi, I have just one question : how to know the size of an array, i have un little program, i use first static, ant i can use sizeof() to know the size, but when i put it as paremeter in the...
9
by: nicnac | last post by:
Hi, I'm self learning javascript - so any pointers are welcomed!! I have an issue passing a form and array from one function to another. I tried many variations ! I can't get this to work...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.