How do you use string operators in qbasic?
In QBASIC, string operators allow you to manipulate and combine strings. The primary operator is the concatenation operator, which is the semicolon (;
) or the plus sign (+
). For example, you can concatenate two strings like this: result$ = "Hello" + " World"
, resulting in result$
containing "Hello World". You can also use the LEN
function to get the length of a string and the MID$
, LEFT$
, and RIGHT$
functions for extracting parts of strings.
How i will write a program in qbasic -to display your name multiple times using do whileloop?
QBASIC code/Editor Screen
(Press key [F5] to make the program RUN/execute...)
====
(Pressing any key returns you straight back to the Editor screen; where you can either chose to further Edit/Re-Run/or else, Save your program.)
Here is another example.
CLS
COLOR 15, 4, 14
PRINT "Press any key to continue"
DO WHILE INKEY$ = ""
LOOP
FOR c = 1 TO 20
COLOR c, 0
PRINT "Replace this with the name you want to display"
NEXT c
COLOR 15, 0
END
How do make 10student name and his remarks in q-basic?
'
'*** PROGRAM: Collecting student data: names/marks.
'
'*** Create 2 array variables to store each students name/marks...
DIM students$(10), marks$(10)
'*** SCREEN ONE/Collect the data...
CLS '...(CL)ear the Output (S)creen
'*** print heading...
PRINT "PROGRAM: Collecting each student names/marks..."
'*** A FOR/NEXT loop is used to collect each individual students data...
FOR eachStudentNo% = 1 TO 10
'*** Get each students names/marks
'by typing these values in from the keyboard....
PRINT eachStudentNo%; ">"
INPUT " Enter student name"; students$(eachStudentNo%)
INPUT "Enter student marks"; marks$(eachStudentNo%)
NEXT
'*** SCREEN TWO: Output the collected data...
CLS '...(CL)ear the Output (S)creen
'*** Print headings...
PRINT "Student No.", "Student Name", "Student Marks"
'*** FOR/NEXT loop is used to print out the 2 array student 'name/marks' values...
FOR eachStudentNo% = 1 TO 10
'*** print out each students 'number/name/mark' values...
PRINT eachStudentNo%,
PRINT students$(eachStudentNo%),
PRINT marks$(eachStudentNo%)
NEXT
END '...END of program/halt program code execution
What is a sub programs in qbasic?
Sub programs allow you to break up one long program; into being a series of much smaller tasks; usually, controlled by a main program. Example...
====
As you can see from the above 2 examples; the 2nd example, although longer, creates code that is much clearer and simpler to read. Even non-programmers should be able to figure out what the 'Main Program' section is doing.
NOTE: There are certain rules for the use of sub-routines. Such as the sub routine should confine itself to doing just 'one' task at a time. So, SUB clearScreen...does just 'one' job, alone...which is to (CL)ear the output (S)creen. It does NOT clear the screen AND get the user to input a number. This makes it quicker and easier to debug programs; as you know exactly where the code is going wrong; so, for example, if the screen didn't clear, properly...then, look at the Sub-routine called: SUB clearScreen. If the title didn't appear; then, look at the Sub-routine called: SUB printTitle. /-Etc.
10 cls
20 input"enter word";word$
30 print word$
40 print len(word$)
50 end
this program is for GW BASIC for other BASIC's the line numbers are optional.
What is the purpose of wend statement in while loop in gw-basic?
While--wend statement is used to execute a loop until a given condition is true.if the condition is false the loop ends and the program continous to the line following eend.
Write a program to swap two numbers using function?
swap (int *a, int *b) {
*a ^= *b;
*b ^= *a;
*a ^= *b;
}
Write a basic program to sort ten numbers?
DIM nums(10)
CLS
FOR i = 0 TO 9
nums(i) = (RND * 10) + 1
PRINT nums(i)
NEXT
PRINT : PRINT "Press Enter to sort numbers"
rem pause to look at numbers
DO WHILE INKEY$ = "": LOOP
CLS
FOR loop1 = 0 TO 9
FOR loop2 = loop1 + 1 TO 9
IF nums(loop1) > nums(loop2) THEN SWAP nums(loop1), nums(loop2)
NEXT
NEXT
FOR i = 0 TO 9: PRINT nums(i): NEXT
BASIC is an acronym which means...
(B)eginner's (A)ll-purpose (S)ymbollic (I)nstruction (C)ode
As a part of the name already implies: (A)ll-purpose/QBASIC is a 'general purpose' programming language; which may be used to write all different sorts of programs, including...
-games
-noughts & crosses/tic tac toe
-databases
-maths
-english
-random poetry
-guess the number
-random graphics
-musical notes
-etc.
This is in direct comparison to certain other programming languages which were designed to do only one main task alone; such as...
FORTRAN/main purpose: Science/Maths
COBOL/main purpose: Business
LOGO/main purpose: Graphics
HTML/main purpose: Write/present web pages
-etc.
Write a qbasic program to accept a no and print it multiple table?
Cls
print the multiples tables of 1 to 5
for x=1 to 5
for y=1 to 10
print x;"*";y;"=";x*y
next y
next x
end
Write a programme to print first 10 even and odd numbers using if statement while loop?
#include<stdio.h>
int main ()
{
printf ("2 4 6 8 10 12 14 16 18 20");
return 0;
}
Write a program that prints the multiplication table for number 6?
'*** Choose which specific times tables number to print out...
intTablesNo%=6
'*** (CL)ear the Output (S)creen...
CLS
'*** Start of FOR/NEXT loop block statement/loop counts upwards from 1 to 12...
FOR intTimesNo%=1 TO 12
'*** PRINT out each times tables number sum...
PRINT intTimesNo%; " X "; intTablesNo%; " = "; intTimesNo%*intTablesNo%
'*** end of FOR/NEXT loop block statement...
NEXT
'*** END of program/halt program code execution...
END
'*** NOTE: Once you understand how the above program works...;
' then, you can safely DELETE all of the explanatory comment statement lines...
' each of which begin with a single apostrophe: ('). -Thanks! ;-)
Where can you download QBasic?
QBASIC free downlaods are from cnet.com or softepedia.com.
Hope this is helpful to you..... if u want anything else just mail it to rockmayur@live.com..
-It was invented by two Darthmouth College professors, John Kemeny and Tom Kurtz in 1964.
-A 19 year old Bill Gates he call as Microsoft BASIC
Enter a number and draw a flow chart to get the reverse of the given number and the number is 435?
123
In order to Download Qbasic you may do one, both or none of these two things:
1.) Go to "http://www.softpedia.com/get/Programming/Coding-languages-Compilers/Qbasic.shtml" and click download
or
2.) use "Google.com" with the keywords Qbasic free download to find another website with a free qbasic downlaod.
Will you please tell the GWBASIC program for the multiplication of two arrays?
just type "chikosalovakia" on gw basic .......................it will give you all instructions............it is a special code.................
How is qbasics relevant to a persons life?
At first, the student learns programming code purely by reading up about it...programming history...which is also the story of hardware/software; different programming languages...in fact, 100's of different programming languages...with newer programming languages being invented, constantly, all the time; concepts: procedural/functional/imperative/object oriented/compiler/interpreter/operating systems; different kinds of programs: based on numbers/text/graphics/sound/-etc.
Next, they decide...yes, this computer science field seems to be really interesting; why not let me try giving it a go myself; first, by copying & pasting other people's example codes; then, running/executing these programs to see if they will work/or, not...???
Next, they have a go at learning to write their own code; naturally, as with learning most subjects to begin with, they will find themselves making MANY mistakes; each of these mistakes will need to be very patiently found/and, then, corrected in order to make their programs work, effectively. Sometimes, after making so many mistakes, repeatedly; they will end up feeling like being a 'total fool!'
The big difference between a 'successful' programmer/and, a 'failed' programmer; is not usually a question of how intelligent the person is; as, the truth is, anyone of just plain normal average intelligence is capable of learning 'the art of programming'. Instead, it's more related to how fully determined they are to stick with learning; no matter how many times their code fails; try, try, again...; and, then, of course, you will, eventually, succeed.
I myself can remember attempting to go write loads of programs which failed; sometimes, I must confess, that I just could not work out why/or else, got totally tired and fed up of trying to go figure it all out?! I either deleted the program, altogether/or else, attempted to either modify/or, re-write the code again starting from total scratch. Whether the program failed/or, RAN successfully; I was still very highly determined to continue along my programming journey.
Some people think that programmers have to be really good at maths; well, all the maths I know is just really simple maths, indeed; namely, how to add/subtract/divide/multiply; thus, people are surprised to know that although I practice doing programming an awful lot, even, daily; yet, I'm not very good at maths in terms of having any high level understanding; in never actually passed any high level exam such as GCSE maths/which is 'base' level maths which school children learn. I guess, I just enjoy understanding the 'logic' of it all. Whereas, real life isn't always entirely logical, at all...?!
A = 1 : B = 2: C = A+B
Q: What's C? A: 3
...this kind of problem I find I have no trouble at all understanding; and, in fact, do seem to understand it almost instinctively; just like a duck taking to water.
I think, that many programmers enjoy programming because, secretly, it makes them feel like being the 'master' who is always issuing commands to the 'slave' computer; and, therefore, who is always 'totally in control!'
You don't need to know a whole entire proramming language in order to be able to use it effectively. Let's say you wish to write a 12 x tables program; and, the language includes 1000's of codes; well, you don't need to go learn all of those 1000's of codes; instead, you just need to learn enough codes that will enable you to get by to be able to write your 12 x tables program, successfully; such as a mere handful of say around 10 or so codes should really be enough.
I must confess that in all my years of practicing doing programming; I never learned a single programming language entirely in full, yet; at the most, I tend to learn about 1/2 of it; though, most times, less than a 1/4; and, yet still I was able to use whichever programming language I learned to create a multitude of different programs which all worked.
In learning certain complex subjects; there is a point when you are a 'beginner'; and, then, you feel you are totally 'outside' of it all...; not quite fully understanding/more doing pure guess work, instead...??? Then, with plenty of time/patience/practice; then, you find that both your skills/understanding do slowly improve; and, you are now actually able to think in terms of the programming language itself; well, suddenly, you've gone and 'crossed the line', and, become an 'insider', now; that is the say that skill has actually become a part of you; just like your body limbs are: arms/feet/-etc.; you will take this skill around with you whereever it is you go in life; and, for all the rest of your entire lifetime to come.
You find that you are, now, actually 'living' being in the programming language...for all of 24/7/366. So, whenever you see a sum written down: 1+1, on a paper sheet/or else, on TV/or, you heard that sum being spoken out aloud; your immediate thoughts are to interpret this problem in terms of programming code...
PRINT 1+1
Or, if you see a game such as noughts and crosses/chess/monopoly/-etc. Then, your immediate thoughts are to interpret this problem in terms of programming code; how would I draw that board? So, you go and emulate trying to write/play the very same game on the computer; be it 'manual' version/or else, 'automatic' version; you might even try coming up with a novel version entirely of your own.
That is how learning a programming language can, ultimately, change you; and, for all the rest of your entire life. You no longer see/interpret the world as being quite the same anymore; instead, if you see a simple shape such as a box-linke shape...be it door/cigerette box/speaker box/TV box/chester draws box/skyscraper shaped like a box...and, immediately, you find yourself thinking in terms of programming code...how would I draw that rectangle shape/and, put together all 4 sides of the box/what about the top and bottom lids of the box, how would I simulate that; could I make the box into a 3D shape that turns/how to color in the boxes sides/what about shape/length/angles/texture/weight/-etc.
You have a timetable written down on a paper sheet; why not translate this into becoming computing code, instead; which could be stored in a more compact form on say a USB memory stick/or, the file uploaded, and, then, accessed over the net from off any internet connected computing device in the world; 24/7/366! Why don't I write a program to password protect my timetable file so that nobody can find it easily; or, even better still, why don't I write a program to encrypt the data itself...so that even if people do find it; they still won't be able to see/understand what the content means?!/-Etc.
And, so on...and, so on...in this sense...when relating 'real life' situation/problems to programming practices; a progammers thinking process never ever actually ends...! Programmers do actually see, and, experience this entire 'world'...in terms which relates back to programming codes; to them everything IS a program; or, could become contained inside of a program; providing they can understand the problem well enough to be able to break it down, step by step; and, thus, be able to define it, effectively.
How do you write a program in BASIC to find the GCD and LCM of two integer numbers?
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y,z,i;
clrscr();
printf("Enter Two Numbers = ");
scanf("d%d",&x,&y);
for(i=1;i<=x*y*z;i++)
{
if(i%x==0&&i%y==0)
{
printf("LCM is %d\n",i);
break;
}
}
getch();
}