'main' must have result type 'int'.
Some compilers erronously accept 'void'.
Use 'std::string', what you have is a buffer that will likely
overflow.
I got this input from user
1+2*3
from this line
cin.getline(Mybuffer, 32 '\n');
No you did not. That won't compile.
My question is how can I compute the result???
Need a little help here u know what I mean...
As Greg P. have answered, check out Bjarne Stroustrup's TCPPPL
book for ideas on how to do that in C++.
But at your current level consider using an interpreted language,
e.g., JScript in Windows,
==================================================================
// Tab = indent = 4
// A _very_ primitive calculator.
// Note: WScript is not part of JScript but is provided by the WSH environment.
var expression;
var stdout = WScript.StdOut;
var stdin = WScript.StdIn;
stdout.Write( "? " );
expression = stdin.ReadLine();
stdout.WriteLine( eval( expression ).toString() );
==================================================================
or VBScript (this also in Windows)
==================================================================
' Tab = indent = 4
' A _very_ primitive calculator.
' Note: WScript is not part of VBScript but is provided by the WSH environment.
option explicit
dim expression, stdout, stdin
set stdout = WScript.StdOut
set stdin = WScript.StdIn
stdout.Write "? "
expression = stdin.ReadLine
stdout.WriteLine Replace( Eval( expression ), ",", "." )
==================================================================
or Perl (more system-independent)
==================================================================
# Tab = indent = 4
# A _very_ primitive calculator.
use strict;
my $expression;
print "? ";
$expression = <STDIN>;
print eval $expression;
==================================================================
Hope this helps...