i have got to create an array which will stored the answers to my questions any idea on how to do this
Array that will store answers to questions
Collapse
X
-
Originally posted by amie857i have got to create an array which will stored the answers to my questions any idea on how to do this
What data type will your answers be?
How many answers do you need to store? -
Originally posted by amie857i 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 pageComment
-
Originally posted by amie857interger. you have to add a and b together to create the maths results
Code:int a; int b; int result[10]; for (int i = 0; i < 10; i++) { cout << "Input the first number for sum " << i + 1; cin >> a; cout << "Input the second number for sum " << i + 1; cin >> b; result[i] = a + b; }
Comment
-
Originally posted by willakawillok. here is a code snippet that will help you on your way
Code:int a; int b; int result[10]; for (int i = 0; i < 10; i++) { cout << "Input the first number for sum " << i + 1; cin >> a; cout << "Input the second number for sum " << i + 1; cin >> b; result[i] = a + b; }
Code:Dim a As Integer Dim b As Integer Dim result(1 To 10) As Integer For i = 1 To 10 a = Cint(InputBox("Input the first number for sum" & i)) b = Cint(InputBox("Input the second number for sum" & i)) result(i) = a + b Next
Comment
-
Originally posted by Killer42Will that really help much in the VB forum? Looks like Java, to me.Comment
-
Originally posted by willakawillOops. glad someone is cleaning up after me. I thought I was answering a c++ question.Comment
-
Originally posted by Killer42Well, 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). :)Comment
Comment