Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My program...
#61
When you look at my program there is a need to add a loop or something after the screen that informs you what the program is about. If it is possible to do this.....;
Ask them their name.
Save their individual responses like by PRINT # 1 into a file, under a name (which you can get by a simple input).
But, then I also need the entire data. I was going to say to delete the data by typing something like a = 0;b=0;c=0.... etc., but then I wouldn't get the total data. Maybe I could do something like;
a=e;b=f;c=g;d=h;aa=ee;ab=fe;ac=ge and so on, and then use a PRINT # 1 command thingy to save it to a file? I don't know, otherwise they will manually have to record their data...
S VERDAD?!
Reply
#62
Quote:Oracle this type would be better. But it would work only in qb 7.1

Code:
Type PType
   Name   as string * 10
   SQ(1 to 10) as integer
End Type

DIM Person(1 to 10) as PType

Arrays in types aren't backwards compatible, so it's not really a good idea to use them if he's on QB4.5 or 1.1, I know what you're saying though.

Terry: types will work. And so will arrays. Just use the online help in the QB IDE (press SHIFT+F1).
Reply
#63
Quote:
TheBigBasicQ Wrote:Oracle this type would be better. But it would work only in qb 7.1

Code:
Type PType
   Name   as string * 10
   SQ(1 to 10) as integer
End Type

DIM Person(1 to 10) as PType

Arrays in types aren't backwards compatible, so it's not really a good idea to use them if he's on QB4.5 or 1.1, I know what you're saying though.

Terry: types will work. And so will arrays. Just use the online help in the QB IDE (press SHIFT+F1).

I still stand by Qb7.1 =)
Reply
#64
Could someone explain to me what this code will do? And, how it works?
S VERDAD?!
Reply
#65
Code:
TYPE SurveyType
  Question1 AS INTEGER
  Question2 AS INTEGER
  ...
  QuestionN AS INTEGER
END TYPE

DIM SHARED People(1 TO N) AS SurveyTYpe

FOR I = 1 TO N
  INPUT "What's your ....", People(I).Question1
  INPUT "Who's your ....", People(I).Question2
  INPUT "Why is your ....", People(I).QuestionN
NEXT I

If ur talkin' 'bout this code then...
1. All it does is defines a type with the required structure.
2. Then dimensions an array to hold the info of 'n' persons.
3. Loops through and asks the questions and gets the answers in the proper variables.

Its simple enough to understand. Do u need a more detailed explanation?
Reply
#66
But, as then, using this, I would have to revise my whole entire program, woudln't I? An then the algorithm (if thats what you wanna call it), wouldn't be able to direct the questions using data from the last question. For example; if answer = "I have a brother" then (goto another question that deals with that brother), but if answer <> "I have a brother" then goto (Another subject, like what is your favorite food.)
S VERDAD?!
Reply
#67
Why are you being so negative? Your prog is barely few lines. What are you complainin' 'bout?

Yes it is possible to get your prog to do that. First lets look at a survey questionaire:

Code:
1. Do u have thing A?
If yes...
   a) how many? b) which model c)...
2. ...

So totally if u have 10 main question and each question has 3 sub questions then u would require 30 elements inside the array of people i.e.

Code:
Type PeopleType
   Name as ...
   Age as ...
   Sex as ...
End Type
DIM Person(1 to no_of_ppl) as PeopleType
DIM PersonalResponse(1 to no_of_ppl, 1 to no_of_survey_questions) as Integer
(Assuming only yes and no types of questions. If you dont just want yes or no replace integer by String then u will be able to input specific answers)

So a person 1's responses will be stored like this:

PersonalResponse(1, 1) = -1 'Yes
PersonalResponse(1, 2) = -1 'Yes
PersonalResponse(1, 3) = 0 'No
PersonalResponse(1, ...) = ... 'Upto thirty survey questions.

[offtopic]
Oracle, I am using a separate array just because of you(Backword compatibility bit and other stuff...=) ).
[/offtopic]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)