[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 14 KB, 354x73, justbasictitle.jpg [View same] [iqdb] [saucenao] [google]
6518010 No.6518010[DELETED]  [Reply] [Original]

hey /sci/,
I dont know if this is the right place for this, but i have a programming question. In my comp sci class, we just started learning BASIC using justbasic. and my professor gave me this problem and i have no clue how to do it.
"Write a program accepts input (numeric) every day and calculates its square then prints that number out on the screen. Every 15 days, display the sum of those calculated numbers."

>> No.6518043

>>>/g/
But really, if you know the syntax, this is easy. just use a for loop for the days that lets you input, square input, store in list/array (idk what it's called in basic) and every time 15 days pass add the items in the list and display.
No idea what syntax is.

>> No.6518070

It's just common sense.

>> No.6518193

If you want to make a program do something once in every arbitrary time interval, you'd either want to use a function to check the current time or use a sleep function. I have never used Just Basic, but according to Rosetta Code, it is based upon another form of Basic called Liberty Basic, which they do have example code for

http://rosettacode.org/wiki/Sleep#Liberty_BASIC
http://rosettacode.org/wiki/Date_format#Liberty_BASIC

Those should help you find out how you might use the functions you're looking for. Hope that sets you in the right direction.

>> No.6518240

>>6518010
>i
>programming question
>comp sci
>started learning BASIC
>. and
>i
>>QUITE LITERALLY A MASKED FIZZ-BUZZ QUESTION

If troll, 7/10.
If serious, reported. Homework and CS does NOT belong on /sci/ and underage faggots don't belong on 4chan. Come back when you turn 21 and learn English.