The system shall activate stick pusher functionality when all of the following conditions are satisfied:
1. stall warning system 1 not failed AND stall warning system 2 not failed AND stick pusher system not failed.
2. the airplane is airborne
3. the airplane altitude is greater than 400 feet.
4. the airspeed is less than 200 knots
5. stick shaker functionality is activated.
int stick_pusher(enum BOOLEAN SWS1_FAIL, enum BOOLEAN SWS2_FAIL, enum BOOLEAN Stick_Pusher_FAIL, enum Onground_Inair_type Onground_Inair, float altitude, float airspeed, enum BOOLEAN Stick_Shaker_Activated)
{
if(SWS1_FAIL==False && SWS2_FAIL==False && Stick_Pusher_FAIL==False && Onground_Inair==Inair && altitude>400 && airspeed<200 && Stick_Shaker_Activated==True)
{
return 1; //stick pusher functionality activated
}
else
{
return 0; //stick pusher functionality not activated
}
}
program
libraries
functions
statements
expression
operands+operators
'' ==> character
" " ==> string
function ==> any no of inputs
==> only one output via return statement
datatype: char, int, float, double
void, return
user-defined functions ==> main()
predefined functions ==> library functions ==> printf()
function definition
function declaration
function call
main()
execution starts with main and ends with main
remaining all other function must be called in main
format specifiers
%d int
%c char
%f or %e float, double
precision
single precision ==> float (6 digits)
double precision ==> double (15 digits)
---------------------------------------------------------------------
keywords: char, int, float, double, void, return
operators: = + *
#include <stdio.h>
void greetings(void); //function declaration
int addition(int x, int y, int z);
float distance(float s, float t);
int main(void)
{
int sum; //variable declaration
float d;
//-------------------
greetings(); //function call
//----------------------
sum = addition(10,20,30);
printf("sum = %d\n",sum);
//----------------------------
d = distance(50.2, 20.6);
printf("d = %f\n",d);
return 0;
}
float distance(float s, float t)
{
float d;
d = s*t;
return d;
}
int addition(int x, int y, int z)
{
int s;
s = x+y+z;
return s;
}
void greetings(void) //function definition
{
printf("Welcome\n");
}
Assignments:
keywords: signed, unsigned, short, long, sizeof, const, extern
operators:
+ - * / % arithmetic o/p
< <= > >= == != relational o/p conditions ==> true/false
&& || ! logical o/p
& | ^ ~ << >> bitwise o/p
= assignment operator
-----------------------
Keywords: if, else, switch, case, default
for, while, do,
break, continue, goto
Operators:
++ -- (type) sizeof , () ?:
can we use signed and unsigned for all 4 basic datatypes?
can we use short and long for all 4 basic datatypes?
AND gate:
Z = A&&B;
AB Z
------
00 0
01 0
10 0
11 1
a,b,c ==> a>b && a>c ==> a is bigger
b>a && b>c ==> b is bigger
c>a && c>b ==> c is bigger
Z = A||B;
AB Z
------
00 0
01 1
10 1
11 1
Z = !A;
A Z
----
1 0
0 1
8 bits ==> 256 values
signed ==> + - (-128 to +127)
unsigned ==> only + (0 to 255)
2 ==> 4 values
3 ==> 8 values
short int <= int <= long int
4 4 8
2 4 4
4 4 4
control statements:
selection statements: if statement-if,else, switch statement-switch, case, default
iterative statements(loops): for, while, do
jump statements: return, break, continue, goto
recursion
int a[10]; //1D array - vector
int a[5][3]; //2D array - matrix
a[0][2] = 8;
5 4 8
6 9 1
9 6 3
7 5 2
int a[4][3][2]; //3D