What is Dev-C++?
Dev-C++, developed by Bloodshed Software, is a fully featured graphical IDE (Integrated Development Environment), which is able to create Windows or console-based C/C++ programs using the MinGW compiler system. MinGW (Minimalist GNU* for Windows) uses GCC (the GNU g++ compiler collection), which is essentially the same compiler system that is in Cygwin (the unix environment program for Windows) and most versions of Linux. There are, however, differences between Cygwin and MinGW; link to Differences between Cygwin and MinGW for more information.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEMI3AlzlfbUXnWk-mLIcZ0T4UuG4T9vApTeI-D-_M1WLbbur74Cr7Og5KNEVTMIF1VayAf1X9XWV6NrCCwl_8wdn9X95Soj8AHSabCRha4evPhcZB56bay06vLQUgJHmmR19_OO83wkEM/w291-h291/cfef5dce3105466d25ca981b1a52982fca005e66ef21ce1254eefe76cf7d20ce_200.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYOJK9xuzGCKMqURTJoQbY6q2LUr7mASoi9wKPs52o4mn8T-GGT0Ykn6oZrX0Q0U4TsCZHfT59hZj1hQ3gzBxWlnbzm4d5SI7J14eU-pOvz2SfGRlBsw2FTukDNiUnvE8qplTpHnwHMvCC/w689-h345/plas1.cpp+-+Dev-C%252B%252B+26-05-2021+19_14_43.png)
No : 1 Open Dev C++
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgVNO11Uvh-CvDQU9zv7aPZv5AejuFU6X5iJOHAz2flCwM_xP1TTZZkOXduWoCK7YUzVd21VD6m5WwrK1zcnS9lGXc_Bo8FppHMzcoTlIK87IGUwEcLfEhClWA2PK5Cgw4Dk4GZx_m8yCb/w585-h293/Dev-C%252B%252B+5.11+26-05-2021+19_19_52.png)
No : 2 press control N (cont +N )
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFGrGJx56xPDs4q-L2pxja330GWty-iP29zh9B63Wyp4rRPueAxK2sWUb4RkrGd0if1Qxd2hjmR8o2_-LvTTF05x7wPfIXtL5haGgiCVj1VUR2OHLjY3iEOAg2WTHO8DUHDsQOCnJAHmxp/w575-h288/Dev-C%252B%252B+5.11+26-05-2021+19_20_24.png)
No : Make a Codes
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsyGCU1uQPWE7zrMK2EXGObPELrVIjkTg1YfPvnNIJs76mQS-pflLov-cP2tQb5ZjyiLebLhhAAy3040M1cYRgQljUcyC7gNSuGc4SqsEnDQYXtRh9gG1G24kC65bgrQtdGhydstuDjYwQ/w587-h294/plas1.cpp+-+Dev-C%252B%252B+26-05-2021+19_14_43.png)
Dev C++ coding
CODEING NO: 1
Make a calculator only Plus
First you copy the code and paste it on Dev C++
#include <stdio.h>
int main()
{ int a,b,sum;
printf("Enter an integer:");
scanf("%d%d",&a,&b);
sum=a+b;
printf("The Sum of two number is %d",sum);
return 0;
}
EXAMPLE
Enter an integer: 8 Enter an integer : 547896 9548773 The Sum of two number is 17 The sum of two number is 1096669
-------------------------------- -------------------------------- --------------------------------
CODEING NO: 2
MAKE A ODD AND EVEN CODE
First you copy the code and paste it on Dev C++
#include <stdio.h>
int main() {
int num;
printf("Enter an integer: ");
scanf("%d", &num);
// true if num is perfectly divisible by 2
if(num % 2 == 0)
printf("%d is even.", num);
else
printf("%d is odd.", num);
return 0;
}
EXAMPLE
Enter an integer: 8 Enter an integer: 2 8 is even. 2 is odd
-------------------------------- -------------------------------- --------------------------------
CODEING NO: 3
Make a largest code
First you copy the code and paste it on Dev C++
#include <stdio.h>
int main() {
int n1, n2, n3;
printf("Enter three different numbers: ");
scanf("%d %d %d", &n1, &n2, &n3);
// if n1 is greater than both n2 and n3, n1 is the largest
if (n1 >= n2 && n1 >= n3)
printf("%d is the largest number.", n1);
// if n2 is greater than both n1 and n3, n2 is the largest
if (n2 >= n1 && n2 >= n3)
printf("%d is the largest number.", n2);
// if n3 is greater than both n1 and n2, n3 is the largest
if (n3 >= n1 && n3 >= n2)
printf("%d is the largest number.", n3);
return 0;
}
EXAMPLE
-------------------------------- -------------------------------- --------------------------------Enter three different numbers: 5 8 6 8 is the largest number.
CODEING NO: 4
Make a bytes in code
Program to Find the Size of Variables
First you copy the code and paste it on Dev C++
#include<stdio.h>
int main() {
int intType;
float floatType;
double doubleType;
char charType;
// sizeof evaluates the size of a variable
printf("Size of int: %zu bytes\n", sizeof(intType));
printf("Size of float: %zu bytes\n", sizeof(floatType));
printf("Size of double: %zu bytes\n", sizeof(doubleType));
printf("Size of char: %zu byte\n", sizeof(charType));
return 0;
}
EXAMPLE
-------------------------------- -------------------------------- --------------------------------
Size of int: 4 bytes Size of float: 4 bytes Size of double: 8 bytes Size of char: 1 byte
CODEING NO: 5
Simple Calculator using switch Statement
First you copy the code and paste it on Dev C++
#include <stdio.h>
int main() {
char o;
double first, second;
printf("Enter an o (+, -, *,): ");
scanf("%c", &o);
printf("Enter two o: ");
scanf("%lf %lf", &first, &second);
switch (o) {
case '+':
printf("%.1lf + %.1lf = %.1lf", first, second, first + second);
break;
case '-':
printf("%.1lf - %.1lf = %.1lf", first, second, first - second);
break;
case '*':
printf("%.1lf * %.1lf = %.1lf", first, second, first * second);
break;
case '/':
printf("%.1lf / %.1lf = %.1lf", first, second, first / second);
break;
// operator doesn't match any case constant
default:
printf("Error! operator is not correct");
}
return 0;
}
EXAMPLE
Enter an c (+, -, *,): +
Enter two operands: 5
2
5.0 + 2.0 = 7.0
-------------------------------- -------------------------------- --------------------------------
CODEING NO: 6
Swap Numbers Using Temporary Variable
First you copy the code and paste it on Dev C++
#include<stdio.h>
int main() {
double first, second, temp;
printf("Enter first number: ");
scanf("%lf", &first);
printf("Enter second number: ");
scanf("%lf", &second);
// Value of first is assigned to temp
temp = first;
// Value of second is assigned to first
first = second;
// Value of temp (initial value of first) is assigned to second
second = temp;
// %.2lf displays number up to 2 decimal points
printf("\nAfter swapping, firstNumber = %.2lf\n", first);
printf("After swapping, secondNumber = %.2lf", second);
return 0;
}
EXAMPLE
Enter first number: 5
Enter second number: 9
After swapping, firstNumber = 9.00
After swapping, secondNumber = 5.00
-------------------------------- -------------------------------- --------------------------------
CODEING NO: 7
Using if Statement
First you copy the code and paste it on Dev C++
#include <stdio.h>
int main() {
double n1, n2, n3;
printf("Enter three different numbers: ");
scanf("%lf %lf %lf", &n1, &n2, &n3);
// if n1 is greater than both n2 and n3, n1 is the largest
if (n1 >= n2 && n1 >= n3)
printf("%.2f is the largest number.", n1);
// if n2 is greater than both n1 and n3, n2 is the largest
if (n2 >= n1 && n2 >= n3)
printf("%.2f is the largest number.", n2);
// if n3 is greater than both n1 and n2, n3 is the largest
if (n3 >= n1 && n3 >= n2)
printf("%.2f is the largest number.", n3);
return 0;
}
EXAMPLE
Enter three different numbers: 10
50
5
50.00 is the largest number.
-------------------------------- -------------------------------- --------------------------------
CODEING NO: 8
Program to Check Vowel or consonant
First you copy the code and paste it on Dev C++
#include <stdio.h>
int main() {
char c;
int lowercase_vowel, uppercase_vowel;
printf("Enter an alphabet: ");
scanf("%c", &c);
// evaluates to 1 if variable c is a lowercase vowel
lowercase_vowel = (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
// evaluates to 1 if variable c is a uppercase vowel
uppercase_vowel = (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');
// evaluates to 1 (true) if c is a vowel
if (lowercase_vowel || uppercase_vowel)
printf("%c is a vowel.", c);
else
printf("%c is a consonant.", c);
return 0;
}
EXAMPLE
Enter an alphabet: A Enter an alphabet: B
A is a vowel. B is a consonant.
-------------------------------- -------------------------------- --------------------------------
CODEING NO: 9
Program to Check Leap Year
First you copy the code and paste it on Dev C++
#include <stdio.h>
int main() {
int year;
printf("Enter a year: ");
scanf("%d", &year);
// leap year if perfectly divisible by 400
if (year % 400 == 0) {
printf("%d is a leap year.", year);
}
// not a leap year if divisible by 100
// but not divisible by 400
else if (year % 100 == 0) {
printf("%d is not a leap year.", year);
}
// leap year if not divisible by 100
// but divisible by 4
else if (year % 4 == 0) {
printf("%d is a leap year.", year);
}
// all other years are not leap years
else {
printf("%d is not a leap year.", year);
}
return 0;
}
EXAMPLE
Enter a year: 2021 Enter a year: 2016
2021 is not a leap year. 2016 is a leap year.
-------------------------------- -------------------------------- --------------------------------
CODEING NO: 10
First you copy the code and paste it on Dev C++