PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
C Intro
Basics
Decision Chain.c
1
/*
2
Decision Chain.c
3
4
Check a series of conditions, but only act on the first one that's true.
5
6
http://learn.parallax.com/propeller-c-start-simple/make-several-decisions
7
*/
8
9
#include "
simpletools.h
"
// Include simpletools
10
11
int
main
()
// main function
12
{
13
int
a = 25;
// Initialize a variable to 25
14
int
b = 17;
// Initialize b variable to 17
15
print
(
"a = %d, b = %d\n"
, a, b);
// Print all
16
if
(a > b)
// If a > b condition is true
17
{
18
print
(
"a is larger \n"
);
// Then print this message
19
}
20
else
if
(a < b)
// a > b not true? check a < b
21
{
22
print
(
"b is larger \n"
);
// If true, print this instead
23
}
24
else
// Nothing else true?
25
{
26
print
(
"a equals b"
);
// Print this
27
}
28
}
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
print
int print(const char *format,...) __attribute__((format(printf
Print format "..." args to the default simple terminal device. The output is limited to 256 bytes.
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17