February 29, 2012

C++ example for triangle area with the help of getter setter functions

#include <cstdlib> #include <iostream> //INCLUDING <iomanip> FOR setfill() function #include <iomanip> using namespace std; //We are required to write a class. //Which should have area, base and height private data members (real numbers). //We are declaring class Fortrianglearea class Fortrianglearea { //Private data members area, base and height of float type for fractions private: float […]

Multiplication of objects, array based objects, object multiply by object

#include <cstdlib> #include <iostream> using namespace std; //Objectmultiplication class declaration class Objectmultiplication { private: int array_integers[10]; //Array declaration public: //A default constructor which will initialize all array elements with zero Objectmultiplication() { array_integers[0]=0; array_integers[1]=0; array_integers[2]=0; array_integers[3]=0; array_integers[4]=0; array_integers[5]=0; array_integers[6]=0; array_integers[7]=0; array_integers[8]=0; array_integers[9]=0; } //Declaration of setter and getter functions void setArray1(); void setArray2(); void getArray(); […]

Getter Setter Example Code in C++

#include <cstdlib> #include <iostream> using namespace std; // defining the Student class class Student { string Name, Rollnumber, Semester, CGPA; public: //Default Constructor of the class Student::Student() { Name = “Default Name”; Rollnumber = “Default Roll Number”; Semester = “Default Semester”; CGPA = “Default CGPA”; cout << “:: Student Class :: \n” << endl; } […]

February 25, 2012

Problem Statement: Exchange of currency rates

Problem Statement: Exchange of currency rates (Download) You are required to write a program for Currency Exchange rates. The basic idea is that user/reader will be able to interchange different currencies using our program. User will have three options i.e. Pakistani Rupees, US Dollars, and Euro.   Detailed Description: The program should display   Please […]

November 4, 2011

C Program that prints the rows of DOS screen with different colors

C Program that prints the rows of DOS screen with different colors: It was a challenging task when i was not sure that which version of C language should i use? I tried TC, TC++, Borland’s, Dev Shed’s. By the way final solution was as recommended Borland C++ with bios.h but thanks to Dev Shed’s […]