Function Main
Declare Real turns
Output "Input number"
Input turns
Output ToString(deg2rad(turns)) & " radians"
Output ToString(rad2deg(turns)) & " grades"
End
Function deg2rad (Real x)
Declare Real r
Assign r = x*pi/180
Return Real r
Function rad2deg (Integer x)
Declare Real r
Assign r = 180*x/pi
Return Real r
Declare integer variable m
Declare integer pointer variable ab
Assign 29 to m
Print the address of m and its value
Print the address of ab and the content it points to
Assign the address of m to ab
Print the address of ab and the content it points to
Assign 34 to m
Print the address of ab and the content it points to
Assign 7 to the content of ab
Print the value of m
#include <stdio.h>
int main()
{
//! showMemory()
int* ab;
int m;
m=29;
printf(" Address of m : %p\n",&m);
printf(" Value of m : %d\n\n",m);
ab=&m;
printf(" Address of pointer ab : %p\n",ab);
printf(" Content of pointer ab : %d\n\n",*ab);
m=34;
printf(" Address of pointer ab : %p\n",ab);
printf(" Content of pointer ab : %d\n\n",*ab);
*ab=7;
printf(" Value of m : %d\n\n",m);
return 0;
}
Address of m : 0x7ffeeed0d9ec
Value of m : 29
Address of pointer ab : 0x7ffeeed0d9ec
Content of pointer ab : 29
Address of pointer ab : 0x7ffeeed0d9ec
Content of pointer ab : 34
Value of m : 7
Function Main
Declare Integer k
Assign k = 1
If k=1
Output "t"
End
If k=0
Output "F"
Else
Output "!f"
End
For k = 0 to 3
Output ""&k
End
While k<5
Output ""&k
Assign k = k+1
End
Loop
Assign k = k+1
Output ""&k
Do k<7
End
Function Main
Declare Integer i, n
Assign n = 12
Declare Integer Array a[n]
Assign a[0] = 1
For i = 1 to n-1
Assign a[i] = a[i-1] * 2
End
For i = 0 to n-1
Output "a["&i&"] = " & a[i]
End
End
#include <stdio.h>
int main() {
//! showArray(a, cursors=[i,n], n=8, cw=32)
int i, n = 12;
int a[n];
a[0] = 1;
for (i = 1; i < n; i++) {
a[i] = a[i - 1] * 2;
}
for (i = 0; i < n; i++) {
printf("a[%i] = %i\n", i, a[i]);
}
}
Function Main
Declare Integer Array values[5]
Declare Integer i
Output "Enter 5 integers: "
For i = 0 to 4
Input values[i]
End
Output "Show the Array values: "
For i = 0 to 4
Output values[i]
End
End