I need help...literally

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
jackie_r
Newbie
Posts: 1
Joined: Tue Oct 25, 2005 8:54 pm

I need help...literally

Post by jackie_r »

Hey everyone'
I am brand new to this Basic programming and I have no idea what I am doing. I need help! My teacher doesn't help us with anything, she justs says you'll figure it out. But anyways I would be very grateful if someone would help me with this one problem in my book and please don't laugh at me I am new to this Basic programming: Thanks :D

Here's the problem :
Maria Maderas is thinking about starting a business selling pet rabbits. She currently has one pair of rabbits and would like to know approximately how many rabbits will be born during a given period of time. Assume that each female rabbit will reproduce every four months and that the litters will have an average of eight rabbits. Also assume that half of the rabbits are female. The program should allow Maria to enter a given number of months and then output the number of rabbits she should have by the end of that time period.
~That was out of Chapter 7 Loop Structures in QBasic Second Edition

If anyone could help me that would be wonderful! Thank you! :P :D
RayBritton
Veteran
Posts: 109
Joined: Thu Feb 10, 2005 12:38 pm

Post by RayBritton »

i can't help you but generally at this site (and probably most others) you will not get any help with homework
Seb McClouth

Post by Seb McClouth »

Let's be nice another time:

Code: Select all

print "Number of months: ";
input "",months%

if month%  =< 4 then
  goto display
else
  goto calculate
end if

calculate:

cmonths%=0

do
cmonths%=cmonths%+1
if cmonths%\4 = cmonths%/4 then
a%=cmonths%\4
b%=a%*8
end if
loop while cmonths%<months%

Display:
print "Rabbits by end of period: males: ";b%\2 ;" females: ";b%\2
My advice with other homework is: Read your book, more then once, redo programs you've already written and try to make things yourselfs, it works...

grtz & good luck
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

Seb, when you said to do:

Code: Select all

print "Number of months: ";
input "",months% 
You do realize that you could have done

Code: Select all

INPUT "Number of months: ", months%
Instead? Also, I THINK that that makes it without a question mark, but if it doesnt then just change the "," after the string to a ";".
Image
Seb McClouth

Post by Seb McClouth »

Well that's for jackie to find out... We're not gonna explain all our tricks... right? Same that the program isn't doing completly what it should. I do have the complete right with me... Jacky, if you post you're own attempt I'll tell ya if you're wrong or right...

grtz
Seb
User avatar
matt2jones
Veteran
Posts: 80
Joined: Sat Feb 19, 2005 8:29 am
Location: elsewhere
Contact:

Post by matt2jones »

Seriously, don't write up guys homework for them. That helps no-one. If they're teacher is seriously as incompetant as they say, the whole class will fail and something will be done about it, so if you help a few, the teacher will think she's teaching it fine and the students are fork up, and the whole class will suffer (speaking from personal experiance).

And if the teacher is good and the person is lazy you've just shown them how easy it is to get by exploiting other people... And the world we live in does not need more people learning that particular lesson.

Assuming they're going through the book chronolgicly (which doesn't alway happen), they've been doing this for a while. Unless loops are the first area of difficulty (and I doubt that from the preamble), posting up code with no-explanation will not help anyone understand, and will just encourage the people your trying to help, to copy.
Do not mistake Apathy for feeling Content.

http://www.disjointed.cjb.net - Short Storys
http://matt2jones.deviantart.com - Random Art
http://www.freewebs.com/matt2jones - WebComic
Seb McClouth

Post by Seb McClouth »

You're right there. Say, Jackie... What do you actually not understand of programming? 'cause have you thought to yourselfs:"Is this want I want to do?"

I learned Basic without any book at first. I only had this build-in manual (a.k.a. help) of Qbasic v1.1. Later on I had a couple of books and tried to do things.

grtz
Seb
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post by Rattrapmax6 »

The problem may not be BASIC,. there is math there too... :P .. Tho basic math (No pun intended)...

Okay, yeah, what are you having problems with? :?:
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt »

If you want an INPUT without the question mark, use LINE INPUT instead. :D
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post by Rattrapmax6 »

Nekrophidius wrote:If you want an INPUT without the question mark, use LINE INPUT instead. :D
ROFLOL,... *Ahem* ... :lol:
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

holy crap I completly forgot about line input for the last year and a half... i always just used the , and ; to control punctuation.

I need to go back and read the first 5 chapters of my old QB book...

to busy with java to do that.
Image
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post by Rattrapmax6 »

You do know the difference between LINE INPUT and INPUT right, nath? It's not to controll puntuation if that's what your thinking.... =)
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
User avatar
Zamaster
Veteran
Posts: 174
Joined: Wed Jun 15, 2005 1:51 pm

Post by Zamaster »

*snickers* (no candy bars here)
C:\DOS
C:\DOS\RUN
RUN\DOS\RUN
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

Yeah, I know, but when I read about it in my QB book I didnt really care, and normal input as always done what I needed just fine.
Image
Post Reply