Tuesday, July 3, 2012

Random Numbers - DIE Example - C++ / GNU


A program that illustrates the Random Number Generation, with Rolling Dice.
It will run only on Unix environment.

Movement of Teapot - OpenGL

An openGL program to illustrate the movement of teapot:

#include <cstdlib>
#include <iostream> // C++ I/O
#include <cstdio> // C I/O (for sprintf)
#include <cmath> // standard definitions
#include <GL/glut.h> // GLUT
#include <GL/glu.h> // GLU
#include <GL/gl.h> // OpenGL

Destructor - Java

Java uses finalize() method for Garbage collection. 

Example:

import java.io.*;
public class FinalizeObject extends FileOutputStream


Can you read a space with scanf? - C GNU/Win

If you are a student, and you are learning C, your teacher would have thought you that scanf can't read spaces as it treats spaces as line breakers. But It's not actually like that. See,

#include<stdio.h>
void main(void)
 {
  char line[32];
  printf("Enter a Text with Space :");
  scanf("%s",line);
  printf("\n\nReceived Text : %s",line);
 }

New Color Print for C/C++ DOS/Unix

No need of cprintf(...), no need of textmode(), textcolor(), textbackground().. Just print it as a string usin formatted character (%s). I'll give you examples.

Example Code :

Getting A Line Without Echoing - java.io.Console

Here's a code that can show how to receive a String or a Char[] without echoing

ConIO Extended features for GNU-C

Some of Extended ConIO features for GNU-C. Download it from here..!

Instructions: