diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8ab9a70 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/.vscode +/Task_1.exe +/Task_2.exe +/Task_4.exe +/Task_5.exe +/Task_8.exe +/Task_9.exe \ No newline at end of file diff --git a/Task_1.cpp b/Task_1.cpp new file mode 100644 index 0000000..b9db1ea --- /dev/null +++ b/Task_1.cpp @@ -0,0 +1,53 @@ +// Calculator which can perform basic Arithmetic Operations like addtion,Substraction,Multiplication & Division + +#include +using namespace std; + +int main() +{ + float num1,num2; + char op; + + cout<<"Enter two numbers to perform arithmatic operations : "; + cin>>num1>>num2; + cout<>op; + cout< +#include +using namespace std; + +int main() +{ + int n,i=1,number; + + int high; + int low; + cin>>low>>high; + + cout<<"Lower Limit and Higher limit are : "<>n; + + if(number ==n) + { + cout<<"Congrats you have guessed right number which is "<n){ + cout<<"Low!! Enter a higher number than previous , Number of turns you used is "< +using namespace std; + +int main() +{ + srand(time(0)); // to generate a different random number each time + int Result1=rand()%6+1; // first number after rolling dice1 between [1,6] + + int Result2=rand()%6+1; // second number after rolling dice2 between [1,6] + + cout<<"Result After rolling first Dice : "< +using namespace std; + +int main() +{ + float Tempratue ; + + cout<<"EnterTemprature : "; + cin>>Tempratue; + + + char Unit ; + cout<<"Enter Unit of Temprature (Celsius/Fahrenheit) : "; + cin>>Unit; + cout< +using namespace std; + +void BinaryToDecimal( int binary) +{ + int b=binary; + int ans=0; + while(b!=0) + { + int p=1; + int r=b%10; + //int d=0; + ans+=r*p; + p*=2; + b/=10; + + } + cout<>b; + BinaryToDecimal(b); + return 0; +} \ No newline at end of file diff --git a/Task_9.cpp b/Task_9.cpp new file mode 100644 index 0000000..efaa33a --- /dev/null +++ b/Task_9.cpp @@ -0,0 +1,26 @@ +// A program to generate a random password of userdefined length + +#include +#include +#include +using namespace std; +const char Domain[] = "0123456789!@#$%^&*abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; +int length = sizeof(Domain)-1;// length of our domain string +int main() +{ + int n; // length of our password + cout<<"Enter the length of password:"; + cin>>n; + srand(time(0)); //to generate new character every time + + if(n==0) // if no length is given + { + cout<<"Please enter a minimum length of password ,it can't be empty !!!"; + } + else{ + cout<<"Your password is : "; + for(int i = 0; i < n; i++) + cout << Domain[rand() % length]; // rand() to generate a random character from our domain character array + } + return 0; +} \ No newline at end of file