Skip to main content

Posts

Showing posts from 2018

Caesar cipher Decryption( C++)

 Caesar cipher Decryption #include <iostream> #include <string> #include <iterator> using namespace std; int main() {         string a;     string v;     int k = 0;     const int b =1;     cin >> a;     for(int j =0;j <25; j++)     {                 ++k;         for(int i =0; i<a.length(); i++)       {           v= ((a[i]+ k +65)%26 +65);           cout <<v;               }             cout << "\n";             }         }

Pointer -hackerrank (challenges writeup)

Pointer -hackerrank (challenges writeup)  Pointer https://www.hackerrank.com/challenges/c-tutorial-pointer/problem #include<iostream> using namespace std; void func(int *z,int *f) {    int aa = *z;    *z = *z + *f;    *f = aa- *f;       if(*f < 0)*f *= -1;    } int main() {     int a, b;     int *pa = &a, *pb = &b;     cin >> a>> b;     func(pa,pb);     cout <<a<<endl;     cout<< b; }

MODERN ABC+ ebook part-1 (DOWNLOAD)

for part-2 or for good quality contact at twitter- https://twitter.com/AdityaRoCk34 LINK PART 1 ----  https: //drive.google.com/file/d/1v02QrW1tyq8v_W_enu92sZdFVG-kNg0w/view?usp=sharing

pyobjc-core pip install error python setup.py egg_info" failed with error code 1 in /tmp/pip-build-io5g0t31/pyobjc-core/ [FIX]

ERROR---  sudo pip3 install pyobjc-core  Collecting pyobjc-core   Downloading https://files.pythonhosted.org/packages/7d/0f/2886aab903aa3971674b68d3fc27cdb292ea07fac2118da0463af113274a/pyobjc-core-5.0.tar.gz (790kB)     100% |████████████████████████████████| 798kB 86kB/s     Complete output from command python setup.py egg_info:     running egg_info     error: PyObjC requires macOS to build         ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-io5g0t31/pyobjc-core/ FIX----- On Linux, this is: pip3 install python3 - xlib sudo apt - get install scrot sudo apt - get install python3 - tk sudo apt - get install python3 - dev pip3 install pyautogui

tesserocr PIP ERROR ON LINUX [FIX]

FIX FOR THIS ERROR---  Collecting tesserocr   Using cached https://files.pythonhosted.org/packages/f8/6d/4e81e041f33a4419e59edcb1dbdf3c56e9393f60f5ef531381bd67a1339b/tesserocr-2.3.1.tar.gz Building wheels for collected packages: tesserocr   Running setup.py bdist_wheel for tesserocr ... error   Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dkMND5/tesserocr/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpLxXWiTpip-wheel- --python-tag cp27:   pkg-config failed to find tesseract/lept libraries: Package tesseract was not found in the pkg-config search path.   Perhaps you should add the directory containing `tesseract.pc'   to the PKG_CONFIG_PATH environment variable   No package 'tesseract' found     Failed to extract tesseract version from executable: [...

Functions c++ - hackerrank

  https://www.hackerrank.com/challenges/c-tutorial-functions/problem #include <iostream> #include <cstdio> using namespace std; int max_of_four(int a, int b, int c, int d) {    if (a >= b &&  a>=c && a>=d)       return a;    else if(b>=a && b>=c && b>=d )       return b;    else if(c>=a&& c>=b && c>= d)       return c;    else       return d; }; int main() {    int a,b,c,d;    scanf("%d %d %d %d", &a, &b, &c, &d);     int vv = max_of_four(a,b,c,d);     printf ("%d", vv);     return 0; }

For Loop - c++ hackerrank

For Loop https://www.hackerrank.com/challenges/c-tutorial-for-loop/problem #include <iostream> using namespace std; int main() {    int a, s,i;    cin >>i;    cin>> a;    for(i; i<=a; i++)    {       if(i==1)       {          cout<< "one\n";       }       else if(i==2)       {          cout<< "two\n";       }       else if(i==3)       {          cout<< "three\n";       }       else if(i==4)       {          cout<< "four\n";    ...

Conditional Statements C++ - hackerrank

https://www.hackerrank.com/challenges/c-tutorial-conditional-if-else/problem #include <bits/stdc++.h> using namespace std; int main() {     int n;     cin >> n;         //cin.ignore(numeric_limits<streamsize>::max(), '\n');      if(n == 1)       cout << "one";    else if(n == 2){       cout << "two";    }    else if(n== 3){       cout << "three";    }    else if(n == 4){       cout << "four";    }    else if(n == 5){       cout << "five";    }    else if(n == 6){       cout << "six";    }    else if(n ==7){       cout << "seven";    }    else if(n ...

Basic Data Types C++ - hackerrank

Basic Data Types  https://www.hackerrank.com/challenges/c-tutorial-basic-data-types/problem #include <iostream> #include <cstdio> using namespace std; int main() { int i; long l; char c; float f; double d; scanf("%d %ld %c %f %lf", &i, &l, &c, &f, &d); printf("%d\n%ld\n%c\n%0.3f\n%0.9lf\n", i, l, c, f, d); return 0; }

Codewars — Sum of the first nth term of Series

Your task is to write a function which returns the sum of following series upto nth term(parameter). Series: 1 + 1/4 + 1/7 + 1/10 + 1/13 + 1/16 +... Rules: You need to round the answer to 2 decimal places and return it as String. If the given value is 0 then it should return 0.00 You will only be given Natural Numbers as arguments. Examples: SeriesSum(1) => 1 = "1.00" SeriesSum(2) => 1 + 1/4 = "1.25" SeriesSum(5) => 1 + 1/4 + 1/7 + 1/10 + 1/13 = "1.57"     My Solution     #include <iostream> #include <iomanip> using namespace std; class ta { float ar[50]; int j,f,k,q; float sum=0.00; public: void taa(int k) { f = k; } void paa() { for(j=0; j<f; j++) { ar[j] = 1.00/(1 + j * 3); } } void baa() { for(q=0; q<f; q++) { sum = sum+ar[q]; } cout <<setprecision(3)<< sum; ...
#include<iostream> using namespace std; int main() {    int a[3][3], b[3][2], ab[3][2], i,j,k;    int sum=0;    cout<<"enter 1st matrix"<<endl;    for (i=0; i<3; i++)    {       for (j=0; j<3; j++)       {          cin >>a[i][j];       }    }    cout<<"enter 2nd matrix"<<endl;    for(i=0; i<3; i++)    {       for(j=0; j<2; j++)       {          cin>>b[i][j];       }    }    for(i=0; i<3; i++)    {       for(j=0;j<2; j++)       {          sum=0;          for...

snap run spotify cannot change profile for the next exec call: No such file or directory snap-update-ns failed with code 1: No such file or directory [FIXED]

ERROR  snap run spotify cannot change profile for the next exec call: No such file or directory snap-update-ns failed with code 1: No such file or directory  Soutions-- snap run spotify cannot change profile for the next exec call: No such file or directory snap-update-ns failed with code 1: No such file or directory open terminal and paste these coammand  systemctl status apparmor      # "Yup, dead apparmor"      systemctl restart apparmor      snap restart lxd                             other snap error fix--   error:cannot list snaps: cannot communicate with server:Get http://localhost/v2/find?q=:dial unix /run/snapd.socket:connect:no such file or directory (fixed)  

C++ sizeof Operator

    #include <iostream> using namespace std ; int main () { cout << "Size of char : " << sizeof ( char ) << endl ; cout << "Size of int : " << sizeof ( int ) << endl ; cout << "Size of short int : " << sizeof ( short int ) << endl ; cout << "Size of long int : " << sizeof ( long int ) << endl ; cout << "Size of float : " << sizeof ( float ) << endl ; cout << "Size of double : " << sizeof ( double ) << endl ; cout << "Size of wchar_t : " << sizeof ( wchar_t ) << endl ; return 0 ; }     command sizeof ( ***** )       output

what is difference between signed integers and unsigned integers

  difference between signed integers and unsigned integers         A signed integer is one with either a plus or minus sign in front. That is it can be either positive or negative. An unsigned integer is assumed to be positive . This is important in computing because the numbers are stored (usually) as a fixed number of binary digits. For a signed integer one bit is used to indicate the sign - 1 for negative, zero for positive. Thus a 16 bit signed integer only has 15 bits for data whereas a 16 bit unsigned integer has all 16 bits available. This means unsigned integers can have a value twice as high as signed integers (but only positive values). On 16 bit computers this was significant, since it translates to the difference between a maximum value of ~32,000 or ~65,000. On 32 bit computers its far less signifocant since we get 2 billion or 4 billion. And on 64 bit computers it becomes of academic interest.    

File "./setup.py", line 4, in from setuptools import setup ModuleNotFoundError: No module named 'setuptools'

Traceback (most recent call last):   File "./setup.py", line 4, in <module>     from setuptools import setup ModuleNotFoundError: No module named 'setuptools' FIX- Distribute has been merged with setuptools 0.7, so just get setuptools for both Python 2.7 and 3.x To install this on Debian: sudo apt - get install python - setuptools For Python 3.x sudo apt - get install python3 - setuptools       If you have Python 2 >=2.7.9 or Python 3 >=3.4 installed from python.org, you will already have pip and setuptools, but will need to upgrade to the latest version: On Linux or OS X: pip install - U pip setuptools On Windows: python - m pip install - U pip setuptools

During startup program exited with code 127 - GDB TOOL [FIXED]

  Cannot exec During startup program exited with code 127 - GDB TOOL [FIXED] root@kali:~/Desktop# gdb main GNU gdb (Debian 7.12-6+b1) 7.12.0.20161007-git Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.  Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from main...done. (gdb) r Starti...

C++ : Program to find simple Interest and compound Interest

Program to find simple Interest and compound Interest #include<iostream> using namespace std; int main() {     int p, r, t;     float si, ci;     cout << "Enter value for P R T" << endl;     cin >> p >>r >> t;     si = p*r*t/100;     ci = p*(1+r/100)^t;     cout << "SIMPLE INTREST = " <<si <<"\n" << "COMPOUND INTERESRT= " << ci;     return 0; }

C++ : Program to check whether the entered number is odd or even

Program to check whether the entered number is odd or even  #include <iostream> using namespace std; int main() {     int num;     cout << "Enter any number: ";     cin >> num;     if (num%2 == 0)         cout << "Number is even";     else         cout << "Number is odd";     return 0;    }

C++: program to input three numbers and print the largest of three

    Program to input three numbers and print the largest of three #include <iostream> using namespace std; int main() {     int x,y,z;     cout << "Enter three NUMBER: "<< "\n";     cin >> x >> y >> z;     if(x>y && x>z)     cout << "\n" << x << " is greater";     if (y > x && y > z)     cout << "\n" << y << " is greater";     if (z > x && z > y)     cout << "\n" << z << " is greater";     return 0;     }

C++ :Program that reads temperature in Celsius and displays it in Fahrenheit

Program that reads temperature in Celsius and displays it in Fahrenheit #include <iostream> using namespace std; int main() {         int celsius, fahrenheit;     cout << "Enter temperature in dgree Celcius ";     cin >> celsius;     fahrenheit = 9* celsius/5 +32;     cout << "Temperature in dgrese FAHRENHET: " << fahrenheit << endl;     return 0; }

C++: Program to check wether a number is greater than or less than other number

Program to check wether a number is greater than or less than other number #include <iostream> using namespace std; int main() {     int num1, num2;     cout << "Enter value for num1:"; cin >> num1;     cout << "Enter value for num2: "; cin >> num2;     if (num1 > num2)         cout << "Num1 is greater than num 2\n";     else         cout <<"num1 is smaller than num 2\n";     return 0; }

C++: Program To find Sum of Two numbers

C++: Program To find Sum of Two numbers #include <iostream> using namespace std; int main() {     int num1, num2, sum;     cout << "Enter Number 1: ";     cin >> num1;     cout << "Enter number 2: ";     cin >> num2;     sum = num1 + num2;     cout << "sum of number: " << sum << "\n";     return 0; } Output -

OverTheWire Bandit Wargame Solutions 1-5

 OverTheWire Bandit Wargame Solutions 1-5 How to login OverTheWire first time (2018) lvl 0 login with  ssh bandit0@bandit.labs.overthewire.org -p 2220  password bandit0 lvl - 0 bandit0@bandit:~$ ls readme bandit0@bandit:~$ cat readme boJ9jbbUNNfktd78OOpsqOltutMc3MY1 bandit0@bandit:~$ exit lvl - 1 ssh bandit1@bandit.labs.overthewire.org -p 2220 boJ9jbbUNNfktd78OOpsqOltutMc3MY1 bandit1@bandit:~$ file ./-* ./-: ASCII text bandit1@bandit:~$ cat ./- CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9 bandit1@bandit:~$ quit lvl - 2 ssh bandit2@bandit.labs.overthewire.org -p 2220 CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9 bandit2@bandit:~$ cat "spaces in this filename" UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK lvl - 3  ssh bandit3@bandit.labs.overthewire.org -p 2220  UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK  bandit3@bandit:~$ cd inhere bandit3@bandit:~/inhere$ ls bandit3@bandit:~/inhere$ ls -l total 0 bandit3@bandit:~/inhere$ ls -a .  ..  .hidden...

How to login OverTheWire first time (2018)

HOW TO LOGIN OverTheWire Steps 1 : fire up terminal steps 2: copy this command and past them at terminal ssh bandit0@bandit.labs.overthewire.org -p 2220 steps 3: now give permission by entering yes (if it ask) steps 4: now Enter this password bandit0   TO complete first level use cat readme command     second lvl password is boJ9jbbUNNfktd78OOpsqOltutMc3MY1 now lets login for second level -- get exit from ssh terminal with exit command  steps 5: login for second account with this command ssh bandit1@bandit.labs.overthewire.org -p 2220 here we change value from 0 to 1  steps 6: use passqword which we extracted from level 0 boJ9jbbUNNfktd78OOpsqOltutMc3MY1 done we will do same for every level by change value 0 ,1,2,3,4,etc...... ssh bandit1@bandit.labs.overthewire.org -p 2220   ----- lvl 1 ssh bandit2@bandit.labs.overthewire.o...

C++: Write a program to print the largest of 3 number using conditional operator

Write a program to print the largest of 3 number using conditional operator #include<iostream> using namespace std; int main() {     int a, b, c;     cout << "Enter 3 no\n";     cin>>a>>b>>c;     int big =  ( a>b && a>c )?a:(b>c?b:c);     cout<<"\nAmong "<<a<<" , "<<b<<" , "<<c<<" Biggest is "<<big<<endl;     return 0; }

C++: Write a Program to Find the S.I given Principal = 100 , take rate and time from the User

Write a Program to find the S.I given Principal = 100 , take rate and time from the User #include<iostream> using namespace std; int main() {     int principle = 100;     int rate, time, intrest;     cout << "Enter rate= ";     cin>>rate;     cout<<"Enter time= ";     cin>>time;     intrest=(principle*time*rate)/100;     cout <<"The intrest rate is = "<<intrest<<endl; }

C++: Program to calculate and display area of a circle

C++: Program to calculate and display area of a circle #include <iostream> using namespace std; int main() {     float radius;     float area;     cout << "enter radius:";     cin >> radius;     area = radius * radius * 3.14;     cout << "area of the circle of is:" << area;     return 0; } Result -

C++ : squaring number in C++ script

C++ : squaring number in C++ script #include <iostream> #include <stdlib.h> using namespace std; int main() {   ("cls");    //For clearscreen funtion for Turbo C++ version clscr() also work     int var, sqrs;     cout << "enter varible:";     cin >> var;     sqrs = var * var;     cout << "\n" << "The square is :" << sqrs; return 0; } Result - https://code.sololearn.com/c45mw9pXGOUs/#cpp Use this script from here

C++ : Cascading of I/O Operators

C++ : Cascading of I/O Operators  Successive occurrence of operators (">>" or "<<" respectively) can be concatenated    example 1 - cout << "The sum of 2 + 5 = " << 2 +5 \n"; example 2 - cout >> "The result of 8 - 2 is" << 8 -2; example 3 - cout << "the sum of" <<  value1 << "and" << "is" << value 1 + value2 << "\n"; example 4 - Similarly successive occurrences of input operator (>>) can also be concatenated as follows :  cout << " Enter two numbers :"; cin >> value1 >> value2; Demo - ( squaring numbers) #include <iostream> using namespace std; int main() {     int var, sqrs; cout << "enter number:\n"; cin >> var; sqrs = var * var; cout << "\nanswers\n" << sqrs << endl; } Result - Without Cascading - ...

How To Setup Instabot

How To Setup Instabot 1> Fire up terminal apt-get update apt-get dist-upgrade apt-get install apt apt install git 2> git clone https://github.com/instagrambot/instabot.git  copy downloaded (instabot) folder in new folder on Desktop (my folder name is Instagram) Now Go To Desktop>Instagram>instabot>instabo>api Method 1> Fire up terminal from this folder (click right mouse button & choose Open In Terminal ) Method 2> use this terminal command cd Desktop/instagram/instabot/instabot/api steps 3> now run this command   git clone https://github.com/instagrambot/api.git step 4> c opy all the file of the api which is downloaded from (git clone https://github.com/instagrambot/api.git) from this command and paste this outside the box(Desktop>Instagram>instabot>instabot>api)  and delete downloaded api folder.......... example :-   steps 5> Go T o Desktop>insta...