Tuesday, March 13, 2012

C++: Length and Height Conversion Program

#include <iostream>
using namespace std;

int meter_mill (int m)
{
  int mill;
  mill=m*1000;
  return (mill);
}
int meter_cent (int a)
{
  int cent;
  cent=a*100;
  return (cent);
}
double meter_kil (double a )
{
  double kil;
  kil=a*.001;
  return (kil);
}
double meter_inc (double a)
{
  double inc;
  inc=a*39.37008;
  return (inc);
}
 double meter_feet (double a)
{
  double feet;
  feet=a*3.28084;
  return (feet);
}
double meter_yard (double a)
{
  double yard;
  yard=a*1.09361;
  return (yard);
}
double meter_mile (double a)
{
  double mile;
  mile=a*6.2;
  return (mile);
}
double meter_naut_mile (double a)
{
  double naut_mile;
  naut_mile=a*5.4;
  return (naut_mile);
}
int main ()
{

  char choice;
  double mm,cm,km,in,ft,yrd,m,nm;
  double n;
  cout<<"Choose a Unit of Measurement: \na-Meter-Millimeter \nb-Meter-Centimeter\nc-Meter-Kilometer\nd-Meter-Inches\ne-Meter-Feet\nf-Meter-Yard\nj-Meter-Mile\nk-Meter-Nautical Mile"<<endl;
  cin>>choice;
  switch (choice)
  {
  case 'a':
    cout<<"Enter Number of Meter: ";
    cin>>n;
    mm = meter_mill (n);
    cout << "The height in milimeter is "<<mm<<endl;
    break;
    case 'b':
    cout<<"Enter Number of Meter: ";
    cin>>n;
    cm = meter_cent (n);
    cout << "The height in centimeter is "<<cm<<endl;
    break;
    case 'c':
    cout<<"Enter Number of Meter: ";
    cin>>n;
    km = meter_kil (n);
    cout << "The height in Kilometer is "<<km<<endl;
    break;
    case 'd':
    cout<<"Enter Number of Meter: ";
    cin>>n;
    in = meter_inc (n);
    cout << "The height in Inches is "<<in<<endl;
    break;
    case 'e':
    cout<<"Enter Number of Meter: ";
    cin>>n;
    ft = meter_feet (n);
    cout << "The height in Feet is "<<ft<<endl;
    break;
    case 'f':
    cout<<"Enter Number of Meter: ";
    cin>>n;
    yrd = meter_yard (n);
    cout << "The height in Yard is "<<yrd<<endl;
    break;
    case 'j':
    cout<<"Enter Number of Meter: ";
    cin>>n;
    m = meter_mile (n);
    cout << "The height in Miles is "<<m<<endl;
    break;
    case 'k':
    cout<<"Enter Number of Meter: ";
    cin>>n;
    nm = meter_naut_mile (n);
    cout << "The height in Nautical Miles  is "<<nm<<endl;
    break;
    default:
    cout<<"Out of coverage"<<endl;
    }
  return 0;
}

Monday, March 12, 2012

C++: Compute for the Volume (Rectangular, Cone, Cylinder etc)



#include <iostream>
using namespace std;
 
int rectangular (int l, int w, int h)
{
  int rect_vol;
  rect_vol=l*w*h;
  return (rect_vol);
}
int prism (int a, int b)
{
  int pri_vol;
  pri_vol=a*b;
  return (pri_vol);
}
int cylinder (int a, int b)
{
  int cyl_vol,pi=3.1416;
  cyl_vol=((pi)*(a*a)*b);
  return (cyl_vol);
}
double pyramid (double a, double b)
{
  double pyr_vol;
  pyr_vol=(a*b)/3;
  return (pyr_vol);
}
 int cones (int a, int b)
{
  int con_vol,pi=3.1416;
  con_vol=((pi)*((a*a)*b))/3;
  return (con_vol);
}
double sphere (int a)
{
  int sph_vol,pi=3.1416;
  sph_vol=(4/3)*((pi)*(a*a*a));
  return (sph_vol);
}

int main ()
{
 
  char choice;
  double l,w,h,r,b,pi=3.1416;
  double rec,pri,cyl,pyr,con,sph;
  cout<<"Choose a polygon: \na-Rectangular \nb-Prism\nc-Cylinder\nd-Pyramid\ne-Cones\nf-Sphere"<<endl;
  cin>>choice;
  switch (choice)
  {
  case 'a':
cout<<"Enter length";
cin>>l;
cout<<"Enter width";
cin>>w;
cout<<"Enter height";
cin>>h;
rec = rectangular (l,w,h);
cout << "The volume of the rectangle is "<<rec;
break;
case 'b':
cout<<"Enter base";
cin>>b;
cout<<"Enter height";
cin>>h;
pri = prism (b,h);
cout << "The volume of the prism is "<<pri;
break;
case 'c':
cout<<"Enter radius";
cin>>r;
cout<<"Enter height";
cin>>h;
cyl = cylinder (r,h);
cout << "The volume of the cylinder is "<<cyl;
break;
case 'd':
cout<<"Enter base";
cin>>b;
cout<<"Enter height";
cin>>h;
pyr = pyramid (b,h);
cout << "The volume of the pyramid is "<<pyr;
break;
case 'e':
cout<<"Enter radius";
cin>>r;
cout<<"Enter height";
cin>>h;
con = cones (r,h);
cout << "The volume of the cones is "<<con;
break;
case 'f':
cout<<"Enter radius";
cin>>r;
sph = sphere (r);
cout << "The volume of the sphere is "<<sph;
break;
default: 
cout<<"Out of coverage"<<endl;
}
  return 0;
}

Sunday, February 26, 2012

Windows 7 - Apache in XAMPP wont start

Follow the screen shots. By the way I'm using Windows 7 Professional. In other Operating system just try to see its parallelism in terms of navigating the control panel. Just remember for the keywords in the screen shots. Like control panel, firewall, etc.
Here we go:






After doing all this procedure, restart your pc. After you restarted your apache should work well. See my screen shot after I have done the procedure.


Happy PHP coding. Any questions, dont hesitate to post in the comment section.

Saturday, February 18, 2012

Sample php program download, sample c/c++ program download, visual basic download, IDE basic troubleshooting

Hello guys, looking for a dynamic blog for you to ask questions on programming? You are on the right tract. Just begin a topic and I will try to resolve it. Im online 24/7.

For start with some C/C++ programming basics, you can see it here: Basic variable declaration, basic function programming. Just navigate on the archives.

You can also request for running sample program. Just post on a comment box. YOU DONT NEED TO PAY. I just want to help you guys who is like me once before.

Just email me for your program request.

nielsccian@gmail.com, nielsccian@yahoo.com, ronilo.yap@tvipacific.com.ph.

Just make a comment and ask questions.