السلام عليكم
الاخوة الاعزاء
يرجوا إفادتي بالخطأ في هذا الكود:
#include<iostream.h>
#include<math.h>
/* cos example */
#include <stdio.h>
#include <math.h>
#define PI 3.14159265
void main()
{
int number;
int choise;
cout<<"please enter number \n";
cin>>number;
cout<<"1. The square root ? n ."<<endl;
cout<<"2. The inverse ? 1/n. "<<endl;
cout<<"3. The cosine ? cos(n)."<<endl;
cout<<"4. The cube ? n3."<<endl;
cout<<"5. The logarithm base 10 ? log10n."<<endl;
cout<<"please hose one step \n";
cin>>choise;
switch(choise)
{
case 1:
cout<<"the root is "<<sqrt(number)<<endl;
break;
case 2:
cout<<"the inverse is "<<pow(number,0.5)<<endl;
break;
case 3:
cout<<"the cos is "<<cos (number*PI/180);<<endl;
break;
case 4:
cout<<"the cube is "<<pow(number,3)<<endl;
break;
case 5:
cout<<"the log10 is "<<log10 (number)<<endl;
break;
}
}
لمن احاول اعمل له كومبايلر يطلع لي الناتج التالي
[name@host demo3]$ g++ pa33.cpp
pa33.cpp:18: error: `main' must return `int'
pa33.cpp: In function `int main(...)':
pa33.cpp:43: error: expected primary-expression before '<<' token
[name@host demo3]$
والله يوفقكم يا شباب
