qbasic

in c++, changing cursor location without using the windows handle. Qbasic imitation is slow

房东的猫 提交于 2019-12-13 05:19:43
问题 Sometimes i need to write things on a location of screen (ex: 10th column and 20th row). I searched on the net and found it is done with using windows handler which is using windows.h. Yes, using handles are fast but somewhat complex so i wrote a class that uses only printf(string) and changes the string in a way that it fits to screen and every printf command fills the entire 80x24 console screen. The class imitates QBasic's CLS , LOCATE x,y and PRINT commands. Question: Is there a simpler

Opening a COM port in QBasic on Windows 7

孤人 提交于 2019-12-11 12:29:20
问题 I'm having difficulty opening a COM port in QBasic (obtained from www.qbasic.net) like so OPEN "COM4:9600,N,8,1,BIN" FOR OUTPUT AS #1 However when I execute this statement in QBasic the open keyword is highlighted and I get the error message Bad file name . 回答1: Is Com4: one of the available serial ports? Look in control panel and make it is one of the available ports. Also, you must make sure no other programs have the port open. 回答2: The following works FreeBasic Open Com "COM1:9600,N,8,1"

Convert program from QBasic to Python

China☆狼群 提交于 2019-12-10 13:23:13
问题 Im trying to convert a program that I made in Basic! (QBASIC on iOS) to Python. I am slowly working my way through Python for Dummies but I am stuck on how to convert FOR loops. Can someone help? Bellow is the QB code. REM Prime Numbers v2 REM Av 2.2 seconds for 1000 REM Av 5.3 seconds for 2000 INPUT "Prime numbers upto";limit PRINT t1 = TickCount PRINT "2 3 "; count = 2 FOR posprime = 3 TO limit STEP 2 posfactor = 3 prime = 1 GOSUB testing IF prime = 1 THEN PRINT posprime " "; count = count

Converting Quick BASIC to VB.Net - Random Access Files

[亡魂溺海] 提交于 2019-12-06 02:10:57
I'm trying to convert an old Quick BASIC program to VB.Net. There doesn't appear to be any direct replacement for the old file statements. Building a database seems like overkill for my simple needs. How can I do the following in VB.Net? OPEN "test.dat" FOR RANDOM AS #1 LEN = 20 FIELD #1, 10 AS a$, 10 AS b$ LSET a$ = "One" LSET b$ = "Two" PUT #1, 1 GET #1, 1 PRINT a$, b$ CLOSE #1 The Microsoft.VisualBasic.FileOpen , FilePut , and FileGet statements should be pretty direct replacements for most of your code above. Microsoft.VisualBasic.FileOpen(1, "test.dat", OpenMode.Random, OpenAccess

QBasic 计算还需要净胜/负多少局才能胜率增/减1%

独自空忆成欢 提交于 2019-12-04 18:29:38
2014年的12月29日,写了个VBS脚本,计算还需要连胜多少把才能让自己的胜率提升1%: 这个脚本的地址在: http://my.oschina.net/Tsybius2014/blog/362078 结果后来连着输了几把,胜率掉了1%(汗)。正好昨天看了下QBasic,就用QBasic写段代码计算一下吧 我的编码环境为:编译器为Win32下的FreeBasic(版本1.00.0),IDE为FBIde(版本0.4.6r4) 这段代码计算了还需要连胜多少把才能把自己的胜率提升1%,也计算了还需要连败多少把就会让胜率降低1% 计算规则: 1)以当前玩了426局,获胜86局为例,当前的胜率是0.201878,截去小数后是20%。 2)在这个基础上,连胜4局后,玩了430局,获胜90局,胜率为0.209302,截去小数后还是20%;但在连胜5局后,玩了431局,获胜91局,胜率到达0.211137,截去小数后胜率到达21%!这个时候,就认为是连胜5局后,就可以让胜率增加1个百分点。 3)同理,计算负场时,连负4局后,玩了430局,获胜86局,胜率为0.2,即20%;连负5局后,玩了431局,获胜86局,胜率为0.199536,截去小数后,是19%,视为胜率下降一个百分点。 需要注意的几点是: 1)胜率100%的时候,再连胜多少局胜率都是100% 2)胜率99%的时候

How can I convert QBASIC PLAY Commands to Something More Contemporary?

蹲街弑〆低调 提交于 2019-12-01 04:28:34
I have play commands in my QB application like this: PLAY "MSe8f#4f#8f#8g8a8b4.a4.g4.f#4.o0b8o1e8e8e4d8e2." I'd like to convert these somehow into something modern applications could use. Any thoughts? I'm currently messing around with the application in FreeBasic. You can convert your Play strings into WAV files with a tool like this (C code): // file: play2wav.c #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <math.h> #ifndef M_PI #define M_PI 3.14159265358 #endif double Note2Freq(int Note) // Note=1 = C1 (32.7032 Hz), Note=84 = B7 (3951.07 Hz) { double

How can I convert QBASIC PLAY Commands to Something More Contemporary?

♀尐吖头ヾ 提交于 2019-12-01 01:59:00
问题 I have play commands in my QB application like this: PLAY "MSe8f#4f#8f#8g8a8b4.a4.g4.f#4.o0b8o1e8e8e4d8e2." I'd like to convert these somehow into something modern applications could use. Any thoughts? I'm currently messing around with the application in FreeBasic. 回答1: You can convert your Play strings into WAV files with a tool like this (C code): // file: play2wav.c #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <math.h> #ifndef M_PI #define M_PI 3

How to Read RS232 Serial Port in PHP like this QBasic Program

你离开我真会死。 提交于 2019-11-30 07:37:04
问题 I'm trying to port the following small QBASIC program (which works 100%) to PHP: OPEN "com1:2400,n,8,1,DS," FOR RANDOM AS #3 OPEN "data.dat" FOR OUTPUT AS #2 REM read 17 chars from the port scale$ = INPUT$(17, #3) PRINT scale$ WRITE #2, scale$ CLOSE #2 CLOSE #3 SYSTEM Currently I'm calling it in its compiled (exe) form from PHP (on WAMP5) but I'd like to get rid of the QBASIC and call it directly from PHP. I wrote this PHP function but it just hangs at the fgets() line: function read_port(