#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
void function_b(char input1[]);
void function_o(char input2[]);
void function_d(char input3[]);
void function_x(char input4[]);
bool fact =0;
int main()
{
char input[256];
cout << "Enter expressions, and enter q to exit" << endl;
bool q=0;
while(q ==0 )
{
cin >> input;
if(( input[1] =='0') && (input[2] == 'b') )
function_b(input);
else if((input[1]=='0') && (input[2] == 'o'))
function_o(input);
else if((input[1]=='0') && (input[2] == 'd'))
function_d(input);
else if((input[1] == '0') && (input[2] == 'x' ))
function_x(input);
else if( input[1] == 'q')
q =1;
else
cout << "WrongInput" <<endl;
}
return 0;
}
function_b(input1)
{
bool exit = 0;
int count;
int point_switch=0;
float output=0;
for(count=3;((count=<256)&&(point_switch ==0)) && exit ==0 ; count++)
{
if(( input1[count] <2)&& (input1[count] >= 0 ) )
{
output *=2;
output += input1[count];
}
else if(input1[count] == '.')
{
point_switch = count;
}
else
{
cout << "WrongInput" ;
exit = 1;
}
}
for(;(count=<256) &&(point_switch !=0) ; count++)
{
if((input1[count] < 2) && (input1[count]>=0))
{
if((input1[count] < 2) && (input1[count]>=0))
{
output += input1[count] * pow(0.5, count - point_switch)
}
}
cout << output;
}
}
----------------------------------------------------------------------------
이게 간단하게 2진수, 8진수 10진수, 16진수를 10진수로 변환하는 프로그램인데
(뒷부분은 비슷한 내용이라 생략했음 헤헤)
미칠거 같은게 46번 줄
그러니까 function_b(input1) 이 있는 줄에서
proj2.cpp:46: error: expected constructor, destructor, or type conversion before ??token
자꾸 이런 에러 메세지가 떠
그런데 도저히 뭐가 문제인지 모르겠음, 플갤 고수 형들 도와주세요
뒤에 _b 이런거로만 해놔서그런지 보기짜증나넼ㅋㅋㅋ
니가 문제다
반환타입이랑 인자타입 정의가 없네
헠헠 무슨 말씀인가요?
ㅉㅉ 전자과면 병신이고 컴공과면 자살 추천