I have a little question
I wrote a calculator in cobol, and I'm not so expert
I give you here the code:
DISPLAY "CALCOLATRICE".
DISPLAY "ATTENZIONE, IL RISULTATO NON HA SEGNI!".
DISPLAY "CHE VUOI FARE?".
DISPLAY "1 ADDIZIONE".
DISPLAY "2 SOTTRAZIONE".
DISPLAY "3 MOLTIPLICAZIONE".
DISPLAY "4 DIVISIONE".
DISPLAY "5 ESCI"
ACCEPT INPUT1
IF INPUT1 = 5
DISPLAY "OK, BUON LAVORO :)"
STOP RUN
END-IF.
IF INPUT1 = 1
DISPLAY "PRIMO NUMERO"
ACCEPT A
DISPLAY "SECONDO NUMERO"
ACCEPT B
COMPUTE C= A + B
DISPLAY "Computing"
DISPLAY "Computing."
DISPLAY "Computing.."
DISPLAY "Computing..."
DISPLAY "Computing...."
DISPLAY "Computing....."
DISPLAY "Computing......"
DISPLAY A "+" B " FA..."
DISPLAY C
ELSE
IF INPUT1 = 2
DISPLAY "PRIMO NUMERO"
ACCEPT A
DISPLAY "SECONDO NUMERO"
ACCEPT B
DISPLAY "Computing"
DISPLAY "Computing."
DISPLAY "Computing.."
DISPLAY "Computing..."
DISPLAY "Computing...."
DISPLAY "Computing....."
DISPLAY "Computing......"
DISPLAY A "-" B " FA..."
COMPUTE C= A - B
DISPLAY C
ELSE
IF INPUT1 = 3
DISPLAY "PRIMO NUMERO"
ACCEPT A
DISPLAY "SECONDO NUMERO"
ACCEPT B
COMPUTE C= A * B
DISPLAY "Computing"
DISPLAY "Computing."
DISPLAY "Computing.."
DISPLAY "Computing..."
DISPLAY "Computing...."
DISPLAY "Computing....."
DISPLAY "Computing......"
DISPLAY A "x" B " FA..."
DISPLAY C
ELSE
IF INPUT1 = 4
DISPLAY "PRIMO NUMERO"
ACCEPT A
DISPLAY "SECONDO NUMERO"
ACCEPT B
COMPUTE C= A / B
DISPLAY "Computing."
DISPLAY "Computing.."
DISPLAY "Computing..."
DISPLAY "Computing...."
DISPLAY "Computing....."
DISPLAY "Computing......"
DISPLAY A ":" B " FA..."
DISPLAY C
END-IF
END-IF
END-IF
END-IF.
STOP RUN.
Now, I want to give a message saying "Do you want to do other operations?" and, if the answer is yes it returns to the beginning, and if you say no it goes to the end.
If you can explain to me how, but not with paragraphs if you can. Can I have the code correct?
Now, I want to give a message saying "Do you want to do other operations?" and, if the answer is yes it returns to the beginning, and if you say no it goes to the end. If you can explain to me how, but not with paragraphs if you can. Can I have the code correct?
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INPUT1 PIC 9.
01 A PIC 9(4).
01 B PIC 9(4).
01 C PIC 9(4).
01 Q PIC X VALUE "N".
PROCEDURE DIVISION.
PERFORM WITH TEST AFTER UNTIL INPUT1 = 5 OR Q = "N" OR "n"
DISPLAY "CALCOLATRICE"
DISPLAY "ATTENZIONE, IL RISULTATO NON HA SEGNI!"
DISPLAY "CHE VUOI FARE?"
DISPLAY "1 ADDIZIONE"
DISPLAY "2 SOTTRAZIONE"
DISPLAY "3 MOLTIPLICAZIONE"
DISPLAY "4 DIVISIONE"
DISPLAY "5 ESCI"
ACCEPT INPUT1
EVALUATE INPUT1
WHEN 1
DISPLAY "PRIMO NUMERO"
ACCEPT A
DISPLAY "SECONDO NUMERO"
ACCEPT B
COMPUTE C= A + B
DISPLAY "Computing"
DISPLAY "Computing."
DISPLAY "Computing.."
DISPLAY "Computing..."
DISPLAY "Computing...."
DISPLAY "Computing....."
DISPLAY "Computing......"
DISPLAY A "+" B " FA..."
DISPLAY C
WHEN 2
DISPLAY "PRIMO NUMERO"
ACCEPT A
DISPLAY "SECONDO NUMERO"
ACCEPT B
DISPLAY "Computing"
DISPLAY "Computing."
DISPLAY "Computing.."
DISPLAY "Computing..."
DISPLAY "Computing...."
DISPLAY "Computing....."
DISPLAY "Computing......"
DISPLAY A "-" B " FA..."
COMPUTE C= A - B
DISPLAY C
WHEN 3
DISPLAY "PRIMO NUMERO"
ACCEPT A
DISPLAY "SECONDO NUMERO"
ACCEPT B
COMPUTE C= A * B
DISPLAY "Computing"
DISPLAY "Computing."
DISPLAY "Computing.."
DISPLAY "Computing..."
DISPLAY "Computing...."
DISPLAY "Computing....."
DISPLAY "Computing......"
DISPLAY A "x" B " FA..."
DISPLAY C
WHEN 4
DISPLAY "PRIMO NUMERO"
ACCEPT A
DISPLAY "SECONDO NUMERO"
ACCEPT B
COMPUTE C= A / B
DISPLAY "Computing."
DISPLAY "Computing.."
DISPLAY "Computing..."
DISPLAY "Computing...."
DISPLAY "Computing....."
DISPLAY "Computing......"
DISPLAY A ":" B " FA..."
DISPLAY C
WHEN 5
DISPLAY "OK, BUON LAVORO :)"
END-EVALUATE
IF INPUT1 NOT = 5
DISPLAY "Do you want to do other operations?"
ACCEPT Q
END-IF
END-PERFORM
STOP RUN
.
Outline:
MOVE 'Y' TO do_work
PERFORM UNTIL do_work <> 'Y'
display menu
get response
EVALUATE response
WHEN reponse = 5
MOVE 'N' to do_work
/* other response processing */
END-PERFORM
GOBACK.
Related
I have 2 cells with data inside of them
Cell A1
Contains text
"Search: "
Cell B1
Contains a hyperlink
https://www.google.com
Display Text
"Google"
I want C1 to say "Search : Google" hyperlinked so that when I click on it, it takes me to Google.
The formulas I tried
=HYPERLINK(B1, CONCATENATE(A1, ":", B1, "(", C1, ")"))
=CONCATENATE(A1, ":", HYPERLINK(B1, CONCATENATE(B1, "(", C1, ")")))
Both formulas return in Cell C1
"Search : Google"
But the hyperlink tends to grab the display text which is Google instead of https://www.google.com
I am new to google sheets and am unaware of how to create a sequence of numbers in a column. I want to create a column with numbers from 0 to 1000 in increments of 10
Method 1 (formula)
Copy the following formula =(ROW()-1)*10
Select cells A1:A100
Paste the formula.
Method 2 (fill down series):
Write 0 on A1
Write 10 on A2
Write 20 on A3
Select A1:A3
Click on the bottom right corner of A3, then drag down until A100.
=ARRAYFORMULA({0; ROW(A1:A100)&0})
or:
=ARRAYFORMULA({0\ ROW(A1:A100)&0})
if you want real numbers then use:
=ARRAYFORMULA({0; VALUE(ROW(A1:A100)&0)})
or:
=ARRAYFORMULA({0\ VALUE(ROW(A1:A100)&0)})
In LibreOffice, I have a document with only one page, and want to print the same page 200 copies.
And want to insert in my footer the special caractere : "X / Y".
Where X = the number of curent page printed.
And Y = the number of total printed page, in my case Y=200
So How can I insert X in the footer ?
Thank you
I am trying to figure out how to retrieve the max value in a cell block of 60 cells (1-60) in a column, put that value in the column next to it and move on to 61 for 60 cells and so on. Any help would be appreciated.
Say we have values in column A. In B1 enter 1 and in C1 enter 60.In B2 enter:
=B1+60
and copy downward and in C2 enter:
=C1+60
and copy downward:
Note:
Cols B and C are the boundarys of the sets.
Then in D1 enter:
=MAX(INDIRECT("A" & B1 & ":A" & C1))
and copy downwards:
What are the differences between the 2 pictures below?
PIC X(15)
PIC ----,---,---.99.
Is the bottom just another way to represent the top?
PIC X(15) Represents 15 characters of virtually any type of data, could be
digits, letters or any other symbol (printable or not).
PIC ----,---,---.99 Represents a numeric edited data item capable of holding
values in the range +999999999.99 through -999999999.99. This item will display a leading minus sign if the
value placed into it is negative, otherwise it will display the number without a leading sign. The displayed
number will have comma separators at the indicated positions provided there is at least 1 digit in front of it.
Here are a few samples of the way certain numbers will display:
999999999.99 displays as 999,999,999.99
1234.56 displays as 1,234.56
0 displays as .00
-1234567.12 displays as -1,234,567.12
-3 displays as -3.00
Variables such as this are for display only. Don't even think
about doing arithmetic with them! Given the following data declarations:
01 DISP-NBR PIC ----,---,---.99.
01 NBR PIC S9(9)V99.
The following MOVE operations are both valid
MOVE 1234.56 TO NBR
MOVE 1234.56 TO DISP-NBR
However,
ADD 1 TO NBR
is perfectly valid but...
ADD 1 TO DISP-NBR
Will give you a compile error. Even though DISP-NBR contains numeric data it is in a display only
format. You need to do math using data items that are purely numeric and then MOVE them to display fields
for 'pretty printing'.
This table
describes all of the PICTURE elements that may be used in COBOL and what they are for.
The first one can have any alpha-numeric caracters.
The second one is used to format number. The dash means that if you have a negative number, a dash will be shown beside (at the left) of the number. Only one dash will be displayed. If the number is positive, a space will shown for every dashes.