### C++ Compilation Failed

Posted:

**Mon Sep 17, 2018 11:46 am**Im doing a QBASIC Assignment where i "Write a program that will input a number and print the number, the square of the number, and the cube of the number. Continue the operation until 999 is entered". I've written the code below but i still end up with "C++ Compilation Failed" every time i try and run it. The book is really bad at explaining where i am going wrong and my professor just gave me hint on my GOSUB's so if anybody can explain to me in lighter terms where my problem is occurring it would be greatly appreciated!

Rem Richard Kopycinski

'************************** SQUARE AND CUBE PROGRAM *************************

'

'Variables Used: OriginalNumber --------------> Users Input Number

' SquareOfNumber --------------> Calculated Square

' CubeOfNumber ----------------> Calculated Cube

'

'**************************** Program Main Line *****************************

'

CLS

GOSUB InputNumber

DO While Num <> = 999

GOSUB InitializeScreen

GOSUB CalculateResults

GOSUB PrintResults

GOSUB InPutNumber

LOOP

END

'

'***************************** Input Number *********************************

InputNumber:

Input "Users Input Number:" , OriginalNumber$

RETURN

'

'**************************** Initialize Screen *****************************

InitializeScreen:

CLS

RETURN

'

'**************************** Calculate Results *****************************

CalculateResults:

SquareOfNumber = (OriginalNUmber ^ 2)

CubeOfNUmber = (OriginalNUmber ^ 3)

RETURN

'

'****************************** Print Results *******************************

PrintResults:

PRINT

PRINT , "Original Number: " ; OriginalNumber

PRINT , "Square Of Number: " ; SquareOfNumber

PRINT , "Cube Of Number: " ; CubeOfNumber

RETURN

'

'****************************** End Of Program ******************************

Rem Richard Kopycinski

'************************** SQUARE AND CUBE PROGRAM *************************

'

'Variables Used: OriginalNumber --------------> Users Input Number

' SquareOfNumber --------------> Calculated Square

' CubeOfNumber ----------------> Calculated Cube

'

'**************************** Program Main Line *****************************

'

CLS

GOSUB InputNumber

DO While Num <> = 999

GOSUB InitializeScreen

GOSUB CalculateResults

GOSUB PrintResults

GOSUB InPutNumber

LOOP

END

'

'***************************** Input Number *********************************

InputNumber:

Input "Users Input Number:" , OriginalNumber$

RETURN

'

'**************************** Initialize Screen *****************************

InitializeScreen:

CLS

RETURN

'

'**************************** Calculate Results *****************************

CalculateResults:

SquareOfNumber = (OriginalNUmber ^ 2)

CubeOfNUmber = (OriginalNUmber ^ 3)

RETURN

'

'****************************** Print Results *******************************

PrintResults:

PRINT , "Original Number: " ; OriginalNumber

PRINT , "Square Of Number: " ; SquareOfNumber

PRINT , "Cube Of Number: " ; CubeOfNumber

RETURN

'

'****************************** End Of Program ******************************