Wednesday, September 25, 2024

 How to create a shortcut for a program(application) on windows?

Fisrt of all if you are at desktop screen, click right on mouse and click on new then click on shortcut, after this a pop up will opened type the path of that program you want to create shortcut for and then click on next then if you wnat to give special name you can type it then click on Finish, Congragulations you get the shortcut for your program on your Desktop.

Example:

I want to create shortcut for command prompt;

So following the steps when i reach to give the path of the program i will write 
C:\windows\system32\cmd.exe
After this i will name the shortcut if i want and then finish, i will see the shortcut on the Desktop.

Sunday, October 30, 2022

C++ Problem (10) : How to show that a number entered by user is an even or odd?

 C++ (10) : How to show that a number entered by user is an even or odd?

Code:

#include<iostream>
using namespace std;
int main(){
long int n;
cout<<"****Finding even and odd number.****"<<endl;
cout<<"Enter a number."<<endl;
cin>>n;

if( n% 2==0){
cout<<"You entered an even number."<<endl;
}
else
cout<<"You entered an odd number."<<endl;
return 0;
}

Output:

****Finding even and odd number.****
Enter a number.
56987231
You entered an odd number.

Wednesday, October 26, 2022

C++ Problem (9) : How to swap two numbers without using third variable?

 C++  (9) : How to swap two numbers without using third variable?

#include<iostream>
using namespace std;
int main(){
double a,b;
cout<<"*****Swapping two numbers without using third variable.*****"<<endl;
cout<<"Enter first number."<<endl;
cin>>a;

cout<<"Enter second number."<<endl;
cin>>b;

cout<<"Before swapping:"<<endl;
        cout<<"a = "<<a<<endl;
        cout<<"b = "<<b<<endl;

       a=a+b;
       b=a-b;
       a=a-b;

cout<<"After swapping:"<<endl;
        cout<<"a = "<<a<<endl;
        cout<<"b = "<<b<<endl;
return 0;
}

Output:

*****Swapping two numbers without using third variable.*****
Enter first number.
10
Enter second number.
5
Before swapping:
a = 10
b = 5
After swapping:
a = 5
b = 10

Tuesday, October 25, 2022

C++ Problem (8) : How to swap two numbers? Using third variable.

C++  (8) : How to swap two numbers? Using third variable.

Code:

#include<iostream>
using namespace std;
int main(){
double a,b,c;
cout<<"*****Swapping two numbers using third variable.*****"<<endl;
cout<<"Enter first number."<<endl;
cin>>a;
cout<<"Enter second number."<<endl;
cin>>b;
cout<<"The given numbers are:"<<endl;
    cout<<"a = "<<a<<endl;
    cout<<"b = "<<b<<endl;
    c=a;
    a=b;
    b=c;

cout<<"The numbers after swapping."<<endl;
    cout<<"a = "<<a<<endl;
    cout<<"b = "<<b<<endl;
return 0;
}

Output:

*****Swapping two numbers using third variable.*****
Enter first number.
10
Enter second number.
5
The given numbers are:
a = 10
b = 5
The numbers after swapping.
a = 5
b = 10

Monday, October 24, 2022

C++ Problem (7) : How to find the surface area of a cylinder when radius and height of the cylinder are given?

 C++ (7) : How to find the surface area of a cylinder when radius and height of the cylinder are given?

Code:

#include<iostream>
using namespace std;
int main(){
double r,h,a;
cout<<"*****Finding the surface area of a Cylinder.*****"<<endl;

cout<<"Enter the radius."<<endl;
cin>>r;

cout<<"Enter the height."<<endl;
cin>>h;

         a= 2*3.14*r*h+2*3.14*r;

cout<<"The surface area of cylinder having radius "<<r<<" and height "<<h<<"  approximately : "<<a<<endl;
return 0;
}

Output:

*****Finding the surface area of a Cylinder.*****
Enter the radius.
1
Enter the height.
1
The surface area of cylinder having radius 1 and height 1 approximately : 12.56

C++ Problem (6) : How to find the area of triangle while base and hight of the triangle are given?

 C++: (6) : How to find the area of a triangle while base and hight of the triangle are given?

Code:

#include<iostream>
using namespace std;
int main(){
double b,h,a;
cout<<"*****Finding the area of a Triangle.*****"<<endl;
cout<<"Enter the base."<<endl;
cin>>b;

cout<<"Enter the height."<<endl;
cin>>h;

       a= (b*h)/2;

cout<<"The area of triangle having base "<<b<<" and height "<<h<<" is: "<<a<<endl;
return 0;
}

OutPut:

*****Finding the area of a Triangle.*****
Enter the base.
5
Enter the height.
10
The area of triangle having base 5 and height 10 is: 25

C++ Problem (5) : How to find the area of a rectangle when length and width are given?

C++ :Problem (5) : How to find the area of a rectangle when length and width are given?


Code:

#include<iostream>
using namespace std;
int main(){
double l,w,a;

cout<<"*****Finding the area of  a rectangle.*****"<<endl;
cout<<"Enter the length."<<endl;
cin>>l;

cout<<"Enter the width."<<endl;
cin>>w;

        a= l*w;

cout<<"The area of rectangle having length "<<l<<" and width "<<w<<" is: "<<a<<endl;
return 0;
}

Output:

*****Finding the area of a rectangle.*****
Enter the length.
12
Enter the width.
6
The area of rectangle having length 12 and width 6 is: 72

 How to create a shortcut for a program(application) on windows? Fisrt of all if you are at desktop screen, click right on mouse and click o...