Skip to main content


Programmer/Tester- Aditya Gupta (aka Techy3.5 :-)

I used g++ to compile these on linux

1. Type casting of floating point numeral to integer (either automatic or by type casting)-
Conversion of floating point to integer is by taking the GIF (Greatest Integer Funtion) and NOT ROUNDING OFF

Greatest Integer Function(Maths,12th) it gives the integer part when the original number is written as integer+fractional part (where fractional part is less than 1 but positive)

2. NEsted MultiLine Comment [actually wont work as expected?!]
if you do this in C++....
/*  blah /*blah blah blah*/ blah*/
the last blah will be visible to the compiler!!! (Inference- Multiline-Comment ends whenever */ is encountered, no matter where!!)NEsted MultiLine Comment

3. Size of various types (of C++) on 'Linux' Mint - (and same as in later versions of windows, and most PCs nowadays)
char - 1
int - 4  (and: short - 2, unsigned long - 8)
long long - 8
float - 4
double - 8 (and: long double - 16)

NOTE- All sizes in bytes

4. The Control Characters (for eg. newline and tab) require a BACKSLASH
   *Seems obvious, but in cases where i dont do programming for some time, i get confused in the slash to be used... though i get it from the different colour in vim editor

5. Conversion of int* to char shows the error 'conversion of int* to char loses precision'
   While conversion of int* to char* is OK.

6. Entering Out Of Range value in a declared variable...
   In such a case, the variable will hold the maximum value it can hold, for example an int when given a very long number, it stores 2147483647 (ie. (2^31)-1).

7. Maximum value of unsigned variable = maximum value of signed variable
   The thing I got surprised at was that, it stored the same number in both cases, let it be signed or unsigned! (size of int on my system is 4 bytes(32 bits) as on most)

8. We cannot copy an array into another array of same type and same size by just simple assignment.
for eg. A=B; //where B is initialised, and both are in arrays of size 3
It shows 'error: invalid array assignment'

9. We can use initializer list to give values to elements of array, only when it is declared, after that we can't use it, it will show an error then...
for eg. int A[3]={34,5,4}; //is OK
BUT,    int A[3];
The second one shows 'error: invalid array assignment'
//XX XX XX//
10. I have posted this observation in another post also, ie. "Default return type of any function is int, nowadays atleast... and that main() be default returns 0, if return statement not typed"
    But, I still expected it to be raised as a 'Warning' by the compiler
    So... nor gcc nor g++ raises even any warning about missing return statement.

11. Entering Characters and MIXED data types when asked for an integer...
Case 1: Entered a,b,c etc. -> int variable stores 0
Case 2: Entered string Hi,Bye,etc -> int variable stores 0
//ACTUALLY, It ignores any succeeding character or integer, if first thing entered wasnt a number, but was an integer... So, for it Hi is same as H only!
Case 3: Entered 454d : Stores 454
//Ignores any other data type, in case first entered was some number, then it will just take any character as end of number (for eg. 'Enter key' is also a character)
Case 4: Entered 454d45: Stores 454
//Since it took any further character to be end of number (NOTE: In all cases i am saying number ended, actually the input hasnt ended, but i mean it will be treated like that later...)
Case 5: Enter f344, fsg45, d454fg, etc (ie. character at start) -> int variable stores 0
//Maybe since it just treated b, which will cause its value 0, and since being a character further things weren't even accounted for

12. 'long' and 'long long' have same size, ie. 8 bytes in g++ compiler
   But, 'double' has 8 bytes, while 'long double' has 16 bytes


Popular posts from this blog

Message Scroller (Big and Styled Characters)


    Programmer - Aditya Gupta (aka. Techy15)
    Language - C++


//Known Bug : It doesn't scroll if it the length of the bigger string matches the terminal width, for a second or so

 * VIM : :%s/foo/bar/g finds and replaces ALL 'foo' with 'bar'
 * A - 65
 * a - 97
 *Observation - Terminal in windowed mode has a heiht of 23 lines, width of 80 characters; and in full screen, has a height of 38 lines, and width of 169 characters [Useful for creating clrscr alternative with newlines] */

#include <iostream>
#include <string>
#include <unistd.h>

#ifdef _WIN32   //Macro defined by MSVC (Microsoft Visual C++) compiler (not g++)
    #include <windows.h>
#elif __linux__
    #include <sys/ioctl.h>
#elif __MINGW32__   //MinGW (g++)
    #include <windows.h>
#elif __CYGWIN__    //CygWin (g++)
    #include <windows.h>

using namespace std;

//char l[12][8][10]={{"-----…

LudO - The Game

Programmer - Aditya Gupta (Techy15)
Language - C++
Program - LudO - The Game

/* PLANS- Add functionality for name of player */

//IMP NOTE - See all notes, written in this form "//NOTE..."

//NOTE- Mark 'R','G','B','Y' for gotis, ignore doubling for now
//NOTE- Settings will have options: change default game play order(ie RBYG), change/give names to each colour
//NOTE- Add code in case of attacks
//NOTE- Add stops, and ways to show them distinct from others {may require graphics.h}


/* #include<fstream>
   To be used in case save & resume to be used*/

using namespace std;
//Changes on 16th Oct

//Show gotis as R1, R2... and ask user to enter string R1 or whatever


// Place within appropriate block ...
    short diethrow(){
    int fl=1; //holds 0 if decnum is 0
    while(fl==0) { char *temp;
        temp=new char; short decnum=0;
    unsigned long location=&…

FUN with the FUNCTIONS in C++

1. To define a function outside the class, there MUST be a prototype inside the class.
For eg.
class Jg{
int num;
Jg(){ num=0; }
void Jg::Display() //Error will be here
{ cout<<num;
//This Program will give the error "no 'void Jg::Display()' member function declared in class 'Jg'"

2. What if one member function defined twice, once inside class and once outside?
Will give error "[error]redefintion of int Jg::Display()"
And then pointing on the first defintion it will give "[NOTE] int Jg::Display() previously defined here"
PROGRAM - #include<iostream>
using namespace std;
class Jg{
int num;
int Jg::Display(){ //ERROR
Jg J1;

3. What if a member function declared twice inside the class?
Will show error "int Ag::Display() cannot be overloaded"
Program- #include<iostream>
using namespace std;
class Ag{
int n…