Friday, 9 January 2015

Author Messages










This is blogs my project programming c++ language
Blogs provide an online space for reflective writing and commentary. Campus Pack blogs can be viewable by all students in the class and the instructor. Each student posts individual entries to the blog and the rest of the class can comment on their posts. In a Blackboard course campus pack blogs can be deployed for: 
Everybody plz help if these blogs worng talking.These site working running

Write a Object Oriented Program to Display Studnet Information

// Write a Object Oriented Program to Display Studnet Information

#include<iostream>
#include<stdio.h>
#include<cstdlib>
#include<conio.h>
#include<iomanip>
#include<cstring>
using namespace std;

class student
{
public:

char first_name[50], last_name[50];
int roll;
float ban_mark,eng_mark,mat_mark;

};

int main()
{

student infor;

char option, select;


FILE *fp;
fp=fopen("users.txt","rb+");

if (fp == NULL)
{
fp = fopen("users.txt","wb+");

return 0;

}


while(1)
{

system("cls");
cout << "\n\n";
cout << "\t\t****** INFORMATION OF STUDENTS ******";
cout << "\n\n";
cout << "\n \t\t 1. Add Students";
cout << "\n \t\t 2. Show Records";
cout << "\n \t\t 3. Exit";
cout << "\n\n";
cout <<"\t Select What you want:> infor.first_name;
cout << "Last Name : ";
cin >> infor.last_name;
cout << "Roll No : ";
cin >> infor.roll;
cout << "Marks of Bangla : ";
cin >> infor.ban_mark;
cout << "Marks of English : ";
cin >> infor.eng_mark;
cout << "Marks of Mathmetic : ";
cin >> infor.mat_mark;

fwrite(&infor,sizeof(infor),1,fp);
cout << "\n Add Another Record (Y/N) ";
fflush(stdin);
option = getchar();
}
break;
case '2':
system("cls");
rewind(fp);
cout << "=== View the Records in the Database ===";
cout << "\n";
while (fread(&infor,sizeof(infor),1,fp) == 1)
{
cout << "\n";
cout <<"\t Name of Students : "<< infor.first_name << setw(5)<< infor.last_name;
cout << "\n";
cout <<"\t Roll No : " <<infor.roll;
cout << "\n";
cout <<"\t Bangla : " <<infor.ban_mark;
cout << "\n";
cout << "\t English : " <<infor.eng_mark;
cout << "\n";
cout <<"\t Mathmetics : " <<infor.mat_mark<<endl;
cout<<"\t" <<endl<<"================================="<<endl;
}
cout << "\n\n";
system("pause");
break;

case '3':
system("cls");
fclose(fp);
cout << "\n\n";
cout << "\t\t********************************************************"<<endl;
cout << "\t\t* THANKS BY MD.HASMOT HOSSEN. *"<<endl;
cout << "\t\t********************************************************"<<endl;
cout << "\n\n";
exit(0);
}
}

system("pause");
return 0;
}

Write a program calculate square and cube of given number using inheritance

// write a program calculate square and cube of given number using inheritance

#include<iostream>
using namespace std;
//using by inheritence

class hasmot_cal
{

public:
int a,b,output;
void setnub1(int a)
{
 nub1=a;
}

void setnub2( int b)
{
 nub2=b;
}
protected:
   int nub1=a;
   int nub2=b;
};

class addition:public hasmot_cal
{

public:
void ad()
{
int a,b;
cout<<"\n \n"<<"enter your addition digit?";
cin>>a>>b;
output=a+b;
cout<<""<<"your addition output = "<<" "<<output<<endl;
}
};


class Subtraction:public hasmot_cal
{
public:
void su()
{
int a,b;
cout<<"\n \n"<<"enter your Subtraction digit?";
cin>>a>>b;
output=a-b;
cout<<""<<"your Subtraction output = "<<" "<<output<<endl;
}
};

int main()
{
hasmot_cal ajaira;
addition ss;
ss.ad();
Subtraction pp;
pp.su();

return 0;
};

Write a program calculate square and cube of given number using constractor

// write a program calculate square and cube of given number using constractor
#include<iostream>
using namespace std;
class ac
{
public:
int n;
ac();
~ac();
void sq();
void cb();
};
ac::ac()
{
cout<<"Enter the number : ";
cin>>n;
}
ac::~ac()
{
cout<<""<<endl;
}
void ac::sq()
{
cout<<" The value of square is : "<<n*n;
}
void ac::cb()
{
cout<<" The value of cube is : "<<n*n*n;
}

int main()
{
ac sss;
sss.sq();
cout<<endl;
sss.cb();
//return 0;
}

Write a program calculate square and cube of given number using polymafaiom


//write a program calculate square and cube of given number using polymafaiom
#include<iostream>
using namespace std;

class sc
{
public:
void setnum(int n)
{
number=n;
}
protected: int number;
};

class square: public sc
{

public:
int re;
void sq()
{
re=number*number;
cout<<"The result of sq : "<<re;
}

};
class cube: public sc
{

public:
int re;
void cub()
{
re=number*number*number;
cout<<"The result of cube : "<<re;
}

};

int main()
{
int n;
square s;
cube cb;
sc *p1=&s;
sc *p2=&cb;
cout<<"Enter the number ofr sq: ";
cin>>n;
p1->setnum(n);
s.sq();
cout<<"\n\nEnter the number for cube: ";
cin>>n;
p2->setnum(n);
cb.cub();
return 0;
}

Write a program calculate square and cube of given number using inheritance

// write a program calculate square and cube of given number using inheritance

#include<iostream>
using namespace std;
//using by inheritence

class hasmot_cal
{
public:
int a,b,output;
void setnub1(int a)
{
 nub1=a;
}

void setnub2( int b)
{
 nub2=b;
}
protected:
   int nub1=a;
   int nub2=b;
};

class addition:public hasmot_cal
{
public:
void ad()
{
int a,b;
cout<<"\n \n"<<"enter your addition digit?";
cin>>a>>b;
output=a+b;
cout<<""<<"your addition output = "<<" "<<output<<endl;
}
};


class Subtraction:public hasmot_cal
{
public:
void su()
{
int a,b;
cout<<"\n \n"<<"enter your Subtraction digit?";
cin>>a>>b;
output=a-b;
cout<<""<<"your Subtraction output = "<<" "<<output<<endl;
}
};

int main()
{
hasmot_cal ajaira;
addition ss;
ss.ad();
Subtraction pp;
pp.su();

return 0;
};

Write a program Check Whether the given number is Strange or Not

//write a program Check Whether the given number is Strange or Not.

#include<iostream>
using namespace std;
//base class
class strange
{
public:
void setdigit(int d)
{
digit=d;
}
protected:
int digit;
};
//derived class
class number : public strange
{
public:
int i,j,t=1,d;
int devide()
{
while(d!=0)
{
j=d%10;
d=d/10;
for(i=2;i<j;i++)
{
if(j%i==0)
{
t=0;
i=j;
}
}
}
}
int check()
{
if(t==1)
cout<<"number is strange";
else
cout<<"number is not strange";
}
};
int main()
{
number hh;
int a;
cin>>a;
hh.setdigit(a);
hh.check();
}

Write a program Whether the given Check Perfect Number

//write a program  Whether the given  Check Perfect Number .

#include<iostream>
using namespace std;

int main(){
    int n,i=1,sum=0;
    cout << "Enter a number: ";
    cin >> n;
       while(i<n){
       if(n%i==0)
       sum=sum+i;
       i++;
}

if(sum==n)
    cout << i << " is a perfect number\n";
else
    cout << i << " is not a perfect number\n";


return 0;

}

Write a program to calculate simple interest amount use default value for rate


// write a program to calculate simple interest amount use default value for rate
#include<iostream>
using namespace std;
class interest
{
int period;
float rate;
float principle;
public:
void get()
{
cout<<"Enter principle Amount: ";
cin>>principle;
cout<<"--------------------"<<'\n';
cout<<"Enter no. of period: ";
cin>>period;
cout<<"--------------------"<<'\n';
}
void cal(float rate)
{
float calculation;
calculation=(principle*period*rate)/100;
cout<<"Simple Interest is: "<<calculation<<'\n'<<'\n';
cout<<"--------------------"<<'\n';
}
};
main()
{
interest b;

b.get();
b.cal(3.8);
return 0;
}

Write a program calculator in Memberfunction


//Write a program calculator using by Memberfunction

#include<iostream>
using namespace std;
class hasmot{
int a,b;
public:

void input()
 {
  cout<<"please enter your digit?";
  cin>>a>>b;
 }

void addition()
{
cout<<"\n \n"<<"enter your addition number?";
cout<<"\n \n"<<"Your addition outpur ="<<a+b<<endl;
}

void subition()
{
cout<<"\n \n"<<"enter your subition number?";
cout<<"\n \n"<<"Your subition outpur ="<<a-b<<endl;
}


void multipution()
{
cout<<"\n \n"<<"enter your multipution number?";
cout<<"\n \n"<<"Your multipution outpur ="<<a*b<<endl;

}

void divied()
{
cout<<"\n \n"<<"enter your divied number?";
cout<<"\n \n"<<"Your divied outpur ="<<a/b<<endl;
}
};


int main()
{
hasmot h;
h.input();
h.addition();
h.subition();
h.multipution();
h.divied();
return 0;

}

Monday, 5 January 2015

Basic Structure of a program


The best way to learn a programming language is by writing programs. Typically, the first program beginners write is a program called "Hello World", which simply prints "Hello World" to your computer screen. Although it is very simple, it contains all the fundamental components C++ programs have==

// my first program in C++
#include <iostream>
using namespace std; 

int main()
{
  cout << "Hello World!";
}

 Output: Hello world!

Sunday, 4 January 2015

Variables and types

To see what variable declarations look like in action within a program, let's have a look at the entire C++ code of the example about your mental memory proposed at the beginning of this chapter:

// operating with variables

#include <iostream>
using namespace std;

int main ()
{
  // declaring variables:
  int h, s;
  int result;

  // process:
  h = 5;
  s = 2;
  h = h + 1;
  result = h - s;

  // print out the result:
  cout << result;

  // terminate the program:
  return 0;
} 
Output:4 

Operators

For example, let's have a look at the following code - I have included the evolution of the content stored in the variables as comments:
// assignment operator
#include <iostream>
using namespace std;
int main ()
{
  int a, b;         // a:?,  b:?
  a = 10;           // a:10, b:?
  b = 4;            // a:10, b:4
  a = b;            // a:4,  b:4
  b = 7;            // a:4,  b:7

  cout << "a:";
  cout << a;
  cout << " b:";
  cout << b;
} 
Output:a:4 b:7 

Basic Input/Output


For Example one Input output::

// h/s example

#include <iostream>
using namespace std;

int main ()
{
  int h;
  cout << "Please enter an integer value: ";
  cin >> h;
  cout << "The value you entered is " << h;
  cout << " and its double is " << h*2 << ".\n";
  return 0;
}




Output:
Please enter an integer value: 702
The value you entered is 702 and its double is 1404.