Switch to full style
For C/C++ coders discussions and solutions
Post a reply

Lines on the plane

Thu Apr 05, 2007 8:58 pm

When you draw a number of lines on a plane it divide the plane into number of parts ,you can calculate them by this C++ program
Code:
#include<iostream>
using namespace std;

int main()
{
   int n,i;
   char choise;
   cout<<"\n\n                                Cairo University          "<<endl;
   cout<<"                     Faculty of computers and information"<<endl;
   cout<<"                               CS - MATH SOCIETY"<<endl;
   cout<<"                            ---------------------"<<endl<<endl;
   cout<<"                                INFINITY  GROUP "<<endl;
   cout<<"                                      <><>"<<endl;
         cout<<"\n\n\tWhen you draw anumber of lines on aplane it divide the plane into\n\t\t\t\t anumber of parts .\n\t\t     We now can calculate them by this program. \n\n\t\t\t      ***lines and parts***";
   do
   {
      cout<<"\n\n\t\t\tThe number of lines =  ";
      cin>>n;
      i=((n*n)+n+2)/2;
      cout<<"\n\n\t\tNumber of parts  =  "<<i<<endl;
      cout<<"\n\tAre you want to test another number?(y/n)  ";
      cin>>choise;
   }
   while(choise=='y'||choise=='Y');
   cout<<"   \n\n                       *** WITH MY BEST WISHES ***"<<endl;
   cout<<"                                INFINITY  GROUP "<<endl;
   cout<<"                                      <><>"<<endl;
   cout<<"\t\t\tType Exit to close the program : ";
   cin>>choise;
   return 0;
}




Post a reply
  Related Posts  to : Lines on the plane
 Sphere by Lines     -  
 Drawing Lines in php     -  
 Script ingoring lines     -  
 Draw Triangle using Lines     -  
 increase the number of bank lines by <br/>     -  
 draw any number of lines on mouse clicks     -