cppfunctions

My attempt to bring c/c++ functions to python


Keywords
c++functions, cfunctions
License
MIT
Install
pip install cppfunctions==2.1.1

Documentation

Shamyak Goel

cppfunctions includes functions from c/c++ and syntax is very similar to c/c++

  • Please install the package ansd share this package to your friend's
  • Also subscribe my youtube channel Codewithshamyak

Features

  • Popular c/c++ functions in python
  • Includes printf and scanf

Installation

cppfunctions requires python interpretor (python 3)

Install python on python.org and download latest version of python then

Install the package as shown below

pip install cppfunctions

Guide to install:- Guide to install cppfunctions

If you get an error - pip is not recognized as function etc. then wacth this video - Click Here

Functions

All functions

  • fopen : Identical to c/++ fopen function. Opens a file in text mode.
  • fgets : Identical to c/c++ fgets function. Writes a string to a file.
  • fputs : Identical to c/c++ fputs function. Reads a string from a file.
  • fgetc : Identical to c/c++ fgetc function. Reads a character from a file.
  • fputc : Identical to c/c++ fputc function. Writes a character to a file.
  • get : Same as fgetc function.
  • put : Same as fputc function.
  • puts : Identical to c/c++ puts function. Writes a string to stdout (Screen).
  • getchar : Identical to c/c++ getchar function. Reads a character from stdin (Input).
  • scanf : Identical to c/c++ scanf function. Reads input and convert them into specific formats. (%d or %i for an int , %s for a string , %f for a float , %b for a bolean value)
  • getline : Identical to c++ getline function but you can pass a propmt.
  • gets : Identical to c/c++ gets function. Reads a string from stdin (Input).
  • sscanf : Identical to c/c++ sscanf function. Reads data from an array in specific formats.(%d or %i for an int , %s for a string , %f for a float , %b for a bolean value)
  • sprintf : Identical to c/c++ sprintf function. Writes data into an array in specific formats. (%d or %i for an int , %s for a string , %f for a float , %b for a bolean value)
  • printf : Identical to c/c++ printf function. Writes data in stdout (Screen) in specific formats. (%d or %i for an int , %s for a string , %f for a float , %b for a bolean value)
  • isdigit : Return true of string is a digit string otherwise false
  • priint : New function that writes integers on stdout (Screen).
  • priflo : New function that writes floats on stdout (Screen).
  • pristr : New function that writes strings on stdout (Screen).
  • bopen : Opens a file in binary mode
  • bwrite : Writes encoded content in a binary file
  • bread : Returns text version of decoded binary file
  • fprintf : Identical to c/c++ fprintf function. Writes data in file and you can pass formats of variables.(%d or %i for an int , %s for a string , %f for a float , %b for a bolean value)
  • putc : Identical to c/c++ putc function. Writes a character into a file.
  • getc : Identical tto c/c++ getc function. Returns a character read from a file.
  • strlen: Identical tto c/c++ strlen function. Returns length of string.
  • strcmp: Identical tto c/c++ strcmp function. Returns true if string is equal to another string else false.
  • strncmp: Identical tto c/c++ strncmp function. Returns true if string is not equal to another string else false.
  • strlwr: Identical tto c/c++ strlwr function. Returns lowercase version of string.
  • strupr: Identical tto c/c++ strupr function. Returns uppercase version of string.
  • strrev: Identical tto c/c++ strrev function. Returns reverse of string.
  • strdup: Identical tto c/c++ strdup function. Returns duplicate of string.
  • strchr: Identical tto c/c++ strchr function. Return the lowest index in string where character is found else false.
  • strstr: Identical tto c/c++ strstr function. Return the lowest index in string where substring is found else false.

New functions

  • strlen: Identical tto c/c++ strlen function. Returns length of string.
  • strcmp: Identical tto c/c++ strcmp function. Returns true if string is equal to another string else false.
  • strncmp: Identical tto c/c++ strncmp function. Returns true if string is not equal to another string else false.
  • strlwr: Identical tto c/c++ strlwr function. Returns lowercase version of string.
  • strupr: Identical tto c/c++ strupr function. Returns uppercase version of string.
  • strrev: Identical tto c/c++ strrev function. Returns reverse of string.
  • strdup: Identical tto c/c++ strdup function. Returns duplicate of string.
  • strchr: Identical tto c/c++ strchr function. Return the lowest index in string where character is found else false.
  • strstr: Identical tto c/c++ strstr function. Return the lowest index in string where substring is found else false.

License

MIT