c/declarations,loops
This commit is contained in:
parent
4b3b97e04b
commit
920e032038
1 changed files with 19 additions and 3 deletions
|
@ -13,14 +13,21 @@ Main
|
||||||
system("pause");
|
system("pause");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Declarations
|
||||||
|
------------
|
||||||
|
|
||||||
|
.. code:: c
|
||||||
|
|
||||||
|
char operator;
|
||||||
|
int entry1 = 0;
|
||||||
|
int entry2 = 0;
|
||||||
|
long entry = 0;
|
||||||
|
|
||||||
Input
|
Input
|
||||||
-----
|
-----
|
||||||
|
|
||||||
.. code:: c
|
.. code:: c
|
||||||
|
|
||||||
int entry1 = 0;
|
|
||||||
char operator;
|
|
||||||
int entry2 = 0;
|
|
||||||
printf("type in 2 integers\n");
|
printf("type in 2 integers\n");
|
||||||
scanf("%d%s%d", &entry1, &operator, &entry2);
|
scanf("%d%s%d", &entry1, &operator, &entry2);
|
||||||
printf("sum: %d\n", entry1 + entry2);
|
printf("sum: %d\n", entry1 + entry2);
|
||||||
|
@ -45,3 +52,12 @@ Conditions
|
||||||
default:
|
default:
|
||||||
printf("Nope!\n");
|
printf("Nope!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loops
|
||||||
|
-----
|
||||||
|
|
||||||
|
.. code:: c
|
||||||
|
|
||||||
|
while (condition) {
|
||||||
|
expression1;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue