QBasic help....

Discussion in 'General Computing' started by RUDY03, Aug 7, 2016.

  1. RUDY03

    RUDY03 Member

    Joined:
    Jul 27, 2016
    Messages:
    30
    Likes Received:
    1
    I'm pretty new to QBasic, and I have missed the classes in school concerning

    a) PRINT TAB
    b) END IF commands.

    I shall be very very grateful indeed, if someone would please urgently clear my doubts, by putting in the syntax of both commands separately and using example programs.

    P.S. I use QB64 for practice purposes at home.
     
  2. Neemobeer

    Neemobeer Windows Forum Team
    Staff Member

    Joined:
    Jul 4, 2015
    Messages:
    2,418
    Likes Received:
    366
    PRINT TAB(#) moves the text over # number of columns where X is an integer. If it exceeds the width of a row it will wrap to the next row.

    END IF simply ends an IF statement

    IF <condition> Then
    <execute some code>

    END IF
     
    RUDY03 and kemical like this.
  3. RUDY03

    RUDY03 Member

    Joined:
    Jul 27, 2016
    Messages:
    30
    Likes Received:
    1
    Hey friends!
    My exams are near, and I need serious help in BASIC programming...

    Question:
    1) WAP in BASIC to input 50 numbers. Display sum of all even numbers among given set of numbers.

    2) WAP in BASIC to find the sum of negative odd numbers and product of positive even numbers separately in a set of 100 numbers entered by an user.

    3)In a class the teacher wants to calculate average marks of 45 students. WAP to input 45 marks and calculate average marks.

    4)Write a program in BASIC to print:​

    (a)

    INDIA
    INDI
    IND ​
    IN
    I




    (b)
    A
    I
    D
    N
    I

    5) WAP to enter sentence in upper-case. Count no. of vowels in the sentence.

    That's all for now.......

    Now obviously they want us to use FOR-NEXT loops....otherwise it could have been much easier as well as much longer.....

    I really don't know how to do calculations based on the results of many loops taken together....​
     
    #3 RUDY03, Sep 12, 2016
    Last edited: Sep 12, 2016
  4. RUDY03

    RUDY03 Member

    Joined:
    Jul 27, 2016
    Messages:
    30
    Likes Received:
    1
    Please someone help me fast!!!
     
  5. Neemobeer

    Neemobeer Windows Forum Team
    Staff Member

    Joined:
    Jul 4, 2015
    Messages:
    2,418
    Likes Received:
    366
    1
    • Loop until false (on input) read in number from user and store it in an array
    • Then have a for next loop 0 to < array size. If number mod 2 is 0 add number to sum
    2
    • Loop until false (on input) read in number from user and store it in an array
    • If number < 0 add it to sum of negative numbers
    • if number mod 2 equals 0 take the product of number
    3
    • Loop until false (on input) read in number from user and store it in an array
    • Add up numbers and divide by how many numbers you have
    4
    • a) Use a for next loop that starts at 5 and step -1 and use the LEFT function to print
    • b) A string is an array, so just use a for next loop and print each char using the step variable in the loop
    5
    • Use two nested for next loops the first loop steps through each letter in the sentence
    • The inner loop loops through an array with vowels and checks the current letter in the sentence for a match
     
  6. Ray G Murphy

    Ray G Murphy New Member

    Joined:
    Sep 23, 2016
    Messages:
    4
    Likes Received:
    0
    Me too looking for this same stuff. Thanks for discussing this matter
     
  7. Ray G Murphy

    Ray G Murphy New Member

    Joined:
    Sep 23, 2016
    Messages:
    4
    Likes Received:
    0
  8. Ray G Murphy

    Ray G Murphy New Member

    Joined:
    Sep 23, 2016
    Messages:
    4
    Likes Received:
    0
    QBasic is a subset of QuickBasic version 4.5. The QBasic online help feature contains complete articles explaining version differences between BASICA/GW-BASIC and QBasic, unsupported keywords, and converting BASICA programs for use under QBasic. QBasic provides a "Windows-like" environment supporting the use of a mouse. A menu bar across the top of the screen contains pull-down menu selections.
     
  9. kemical

    kemical Windows Forum Admin
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    Aug 28, 2007
    Messages:
    31,847
    Likes Received:
    1,568
    Threads merged to save confusion.

    Please do not double post as you won't get a faster reply.
     

Share This Page

Loading...