bareedon
Technical User
- Jul 8, 2001
- 28
Just now I instlled Microsoft Visual C++ ver 6 in my Win2k pro station because Turbo C++ dos not work in win2k pro ....But I never work with visual C++ befor . So I want to know how to open *.cpp file under Microsoft visual C++ also, Is there any changes need to be done in the porgram it self. like the program below which I wrote it in Turbo C++ what shall I need to change ?
#include<conio.h>
#include<iostream.h>
#include<stdio.h>
int fact (int p)
{
int factp =1;
while (p!=1)
{factp*=p;
--p;
}
return factp;
}
void main()
{
char ch;
int factp,factr,factd,cr,pr,p,r;
B: clrscr ();
cout<<"type the p number: ";cin>>p;
cout<<"Type the r number: ";cin>>r;
factp=fact(p);
factr=fact(r);
factd=fact(p-r);
pr=factp/factr;
cr=pr/factr;
cout<<"The value of pr is : "<<pr<<endl;
cout<<"The value of cr is : "<<cr<<endl;
cout<<"The value of factp is : "<<factp<<endl;
cout<<"The value of factr is : "<<factr<<endl;
cout<<"The value of factd is : "<<factd<<endl;
cout<<"endl<<"please Type y to contnue or n to stop ";
ch=getch();
if((ch=='y'))||(ch=='Y'))
goto B;
}
#include<conio.h>
#include<iostream.h>
#include<stdio.h>
int fact (int p)
{
int factp =1;
while (p!=1)
{factp*=p;
--p;
}
return factp;
}
void main()
{
char ch;
int factp,factr,factd,cr,pr,p,r;
B: clrscr ();
cout<<"type the p number: ";cin>>p;
cout<<"Type the r number: ";cin>>r;
factp=fact(p);
factr=fact(r);
factd=fact(p-r);
pr=factp/factr;
cr=pr/factr;
cout<<"The value of pr is : "<<pr<<endl;
cout<<"The value of cr is : "<<cr<<endl;
cout<<"The value of factp is : "<<factp<<endl;
cout<<"The value of factr is : "<<factr<<endl;
cout<<"The value of factd is : "<<factd<<endl;
cout<<"endl<<"please Type y to contnue or n to stop ";
ch=getch();
if((ch=='y'))||(ch=='Y'))
goto B;
}