Upload
nurul-zakiah-zamri-tan
View
284
Download
0
Embed Size (px)
Citation preview
WORKING WITHINTERGRATED DEVELOPMENT ENVIRONMENT
(IDE)
PREPARED BY Mrs. Nurul Zakiah
Examples: Visual Studio(VB.NET,C#), Codeblock(C,C++), Netbean(JAVA), Xcode(C#,JAVA,Phyton)
In this lab: DEVC++ for C
Provides to write, editing code
A way to compile/debug the code
Create and Test Your project
Some IDE not only write text but maybe it has embedded with object, Translator, or prescript code which may help the coding is done more easier
Deliver into application that we use
What is IDE??
Example of IDE
Visual Studio
DEVC++
Fundamental of C
Reserved keyword in C must be written as included in the compiler:User cannot change its appearance!
Example int, float, goto, else, char,void, main….Others are printf, scanf, and more..
Variable name cannot be used as same as the reserved keywordC variable refers to the name given to the memory location to
store data
Basically a a program C must have:
Main()
{
}
Rule to name a variable: Must start with alphabet, cant be start with number Can be written in lower and uppercase Cannot use reserved keyword in C Special character not allowed only (_)
Data types Format string
int %d
Unsigned int %u
Float % f
Long %ld
Unsigned long
%lu
double %lf
Long double %lf
char %c /%s
Unsigned char
%c/%s
Data Type:
Operators
Binary Operator
Operator operation Ex
+ addition x=5+6
- subtraction x=10-5
* multiplication x=5*4
/ division x=5/3 =1
% modulo operator
x=5%3 =2
Unary operators:
Operator operation Ex
++ increment i++
-- decrement i--
Relational Operator
Operator operation Ex
> greater than a>b
< less than a<b
>= greater than equal to
a<=b
<= less than equal to a>=b
= = equal to a= =b
!= not equal to a!=b
Logical operators:
Operator operation Ex
&& AND (a>b)&&(a>c)
|| OR (a>b)||(a>c)
#include<stdio.h>
void main()
INT mark;char 1grade;
scan(“%d %c”, &mark, & 1grade);
if(grade = =’a’)
{mark=mark-10;
}printf(“%d”,mark);}
Exercise: Identifying the Error!
Purpose of the program: IF the grade is a, add 10 to the marks
#include<stdio.h>
{float a,b;
void area_rectangle (float, float);clrscr();
printf(“\n enter the length & breadth:”);scanf(“%d %d”, &a, &b);area_rectangle (a,B);getch();}void area_rectangle(x,y)float x,y;{float area;area=x*y;Printf(“\n area of rectangle is %f”, area);return;}
Purpose of the program: To find the rectangle area