Skip to content

Commit d986bd2

Browse files
authored
Add files via upload
1 parent a25b750 commit d986bd2

29 files changed

+986
-0
lines changed

addition two number using ponter.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include<iostream> // Include the input-output stream library
2+
#include<conio.h> // Include the conio.h library for using getch()
3+
4+
using namespace std; // Use the standard namespace
5+
6+
int main() // Main function where execution starts
7+
{
8+
int a, b; // Declare integer variables a and b
9+
10+
// Prompt the user to enter the value of a
11+
cout << "Enter the value of a: ";
12+
cin >> a; // Read the value of a from user input
13+
14+
// Prompt the user to enter the value of b
15+
cout << "Enter the value of b: ";
16+
cin >> b; // Read the value of b from user input
17+
18+
int *p1, *p2; // Declare two integer pointers p1 and p2
19+
20+
p1 = &a; // Store the address of variable a in pointer p1
21+
p2 = &b; // Store the address of variable b in pointer p2
22+
23+
int sum = *p1 + *p2; // Dereference p1 and p2 to get the values of a and b, then add them
24+
25+
// Print the result of the addition
26+
cout << "The addition of the two numbers is: " << sum << endl;
27+
28+
getch(); // Wait for a key press before exiting
29+
30+
return 0; // Return 0 to indicate successful execution
31+
}
32+
getch();
33+
}

addition.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include<iostream>
2+
#include<conio.h>
3+
4+
5+
using namespace std;
6+
7+
8+
9+
10+
// for addition of the number
11+
12+
void addition(int a , int b)
13+
{
14+
int sum =a+b;
15+
cout <<"The addition of two value is:" <<sum<< endl;
16+
}
17+
18+
19+
20+
21+
int main ()
22+
23+
{
24+
int a,b;
25+
cout << " Inter the first value : " ;
26+
cin>> a;
27+
cout <<"Inter the second value : ";
28+
cin>>b;
29+
30+
addition(a,b);
31+
32+
33+
getch();
34+
}

area of the tringle .cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include<iostream>
2+
#include<conio.h>
3+
#include<iomanip>
4+
5+
using namespace std;
6+
7+
8+
int main()
9+
10+
{
11+
12+
double h,b;
13+
14+
cout<< " Please input the value of base : ";
15+
cin>> b;
16+
cout<< " Please input the value of height: ";
17+
cin>> h;
18+
19+
20+
21+
cout<<showpoint;
22+
cout<<fixed;
23+
cout<<setprecision(4);
24+
25+
26+
27+
double area =0.50*b*h;
28+
29+
30+
31+
32+
cout <<"the area of the tringle is: " << area;
33+
34+
35+
36+
37+
38+
39+
40+
getch();
41+
}

asteric pattern.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
#include<iostream> // Include the input-output stream library for using cin and cout
3+
4+
using namespace std; // Use the standard namespace to avoid prefixing std:: to cout and cin
5+
6+
int main() // Main function where execution starts
7+
{
8+
int row, i, n, col; // Declare integer variables for row, column, and number of lines
9+
10+
cout<< "Enter number of lines: "; // Prompt the user to enter the number of lines
11+
cin>> n; // Read the number of lines from the user and store it in variable n
12+
13+
for (row=1; row<=n; row++) // Outer loop to iterate through each row from 1 to n
14+
{
15+
for (col = 1; col<= row; col++ ) // Inner loop to iterate through each column from 1 to the current row number
16+
{
17+
cout <<" * "; // Print the asteric sign
18+
19+
}
20+
21+
cout << endl; // Print a newline character to move to the next row
22+
}
23+
24+
return 0; // Return 0 to indicate successful execution
25+
}

betwise part1.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include<iostream>
2+
#include<conio.h>
3+
4+
using namespace std;
5+
6+
int main ()
7+
8+
{
9+
int a=32;
10+
int b=12;
11+
int c;
12+
13+
14+
c= a&b;
15+
cout<<" the and value of the two given number is : " <<c << endl;
16+
17+
18+
c= a|b;
19+
20+
21+
cout<<" the or value of the two given number is : " <<c << endl;
22+
23+
24+
25+
26+
c= a^b;
27+
cout<<" the xor value of the two given number is : " <<c << endl;
28+
29+
30+
31+
32+
33+
getch();
34+
}

bitewise operator2.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
#include<iostream>
3+
#include<conio.h>
4+
5+
using namespace std;
6+
7+
int main ()
8+
9+
10+
{
11+
int a=32;
12+
//int b=12;
13+
int c;
14+
15+
16+
c= a>>2;
17+
cout<<" the and value of the two given number is : " <<c << endl;
18+
19+
20+
21+
22+
c= a<<2;
23+
cout<<" the xor value of the two given number is : " <<c << endl;
24+
25+
26+
27+
28+
29+
getch();
30+
}

cedlcious to farenhite.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <iostream>
2+
# include <conio.h>
3+
4+
5+
using namespace std;
6+
7+
int main()
8+
{
9+
10+
11+
float c, f;
12+
13+
cout << " input the value of celcious: ";
14+
cin>> c;
15+
16+
17+
f= 1.8* c+32;
18+
19+
cout<< " the vale of farenhite is :" << f;
20+
21+
22+
23+
24+
getch ();
25+
}

char int and double .cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
3+
#include<iostream>
4+
5+
# include<conio.h>
6+
7+
using namespace std;
8+
int main()
9+
10+
{
11+
int a=10, b=20;
12+
double d=10.665;
13+
char ch = 'c';
14+
15+
cout << " the first integer number is = " << a << endl <<" the second integer number is =" << b << endl
16+
<< " the double number is = "<< d << endl << " the character is = "<< ch ;
17+
18+
19+
getch ();
20+
21+
}
22+

do while.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
3+
#include<iostream>
4+
5+
6+
7+
using namespace std;
8+
9+
int main ()
10+
11+
12+
{
13+
int n;
14+
15+
cout<<" How many time you want to print: ";
16+
cin>> n;
17+
18+
int i=1;
19+
do
20+
{
21+
22+
cout<< " Allahu Akbar " << endl;
23+
i++;
24+
25+
}
26+
while(i<=n);
27+
28+
cout<< "End of the for loop";
29+
30+
return 0;
31+
}

escape sequence.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <iostream>
2+
3+
using namespace std;
4+
5+
int main() {
6+
cout << "This is Shahidul Islam"; // normal output
7+
cout << " this is my first program in C++" << endl;
8+
cout << "I will be a";
9+
cout << " SOFTWARE ENGINEER " << endl;
10+
cout << "At Google" << endl;
11+
12+
// we can print all those text in one cout function
13+
cout << "This is Shahidul Islam" << endl
14+
<< "This is my first code in C++" << endl
15+
<< "I will be a " << endl
16+
<< "SOFTWARE ENGINEER" << endl
17+
<< "AT GOOGLE" << endl;
18+
19+
return 0;
20+
}
21+

even odd.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <iostream>
2+
3+
using namespace std;
4+
5+
int main()
6+
{
7+
int num;
8+
9+
// Prompt the user to input an integer
10+
cout << "Input an Integer: ";
11+
cin >> num;
12+
13+
// Determine if the number is even or odd using the ternary operator
14+
(num % 2 == 0) ? cout << "The given number is even" : cout << "The given number is odd";
15+
16+
// Optional: Wait for a key press if using an environment that supports this
17+
// getch(); // Uncomment if getch() is supported
18+
19+
return 0;
20+
}

find the lower number.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#include <iostream> // Include the iostream library for input and output
2+
#include <conio.h> // Include the conio.h library for console input/output functions (specifically getch)
3+
4+
using namespace std; // Use the standard namespace to avoid prefixing std:: to standard library functions
5+
6+
int main() // Main function where execution starts
7+
{
8+
int a, b, c, lower; // Declare integer variables a, b, c to store input values and lower to store the lowest number
9+
10+
// Prompt the user to input the value of a
11+
cout << "Input the value of a: ";
12+
cin >> a; // Read the integer input from the user and store it in variable a
13+
14+
// Prompt the user to input the value of b
15+
cout << "Input the value of b: ";
16+
cin >> b; // Read the integer input from the user and store it in variable b
17+
18+
// Prompt the user to input the value of c
19+
cout << "Input the value of c: ";
20+
cin >> c; // Read the integer input from the user and store it in variable c
21+
22+
// Check if a is less than both b and c
23+
if (a < b && a < c)
24+
{
25+
lower = a; // If a is the lowest, assign a to lower
26+
}
27+
// Otherwise, check if b is less than both a and c
28+
else if (b < a && b < c)
29+
{
30+
lower = b; // If b is the lowest, assign b to lower
31+
}
32+
// If neither a nor b is the lowest, c must be the lowest
33+
else
34+
{
35+
lower = c; // Assign c to lower
36+
}
37+
38+
// Output the lowest number
39+
cout << "The lowest number is: " << lower;
40+
41+
getch(); // Wait for a key press before closing the console window (specific to some IDEs like Turbo C++)
42+
43+
return 0; // Return 0 to indicate successful execution
44+
}

for loop.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include<iostream>
2+
3+
4+
5+
using namespace std;
6+
7+
int main ()
8+
9+
10+
{
11+
int n;
12+
13+
cout<<" How many time you want to print: ";
14+
cin>> n;
15+
16+
17+
for ( int i =1; i<=n; i++)
18+
{
19+
20+
cout<< "I love You" << endl;
21+
22+
}
23+
24+
cout<< "End of the for loop";
25+
26+
return 0;
27+
}

0 commit comments

Comments
 (0)