<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[PROBLEM BEI EINEM MATHE-FUNKTIONSPLOTTER]]></title><description><![CDATA[<p>gute abend,<br />
ich bin noch recht unerfahren in C++ und habe heute mein erstes programm fertiggestellt: einen funktionsplottet der mathematische funktionen(2D) plottet.<br />
bis jetzt hat es auch für den anfang sehr gut geklappt und mein programm wäre fertig, wenn da nicht folgendes problem wäre:<br />
MAN KANN KEINEN EIGENEN FUNKTIONSTERM EINGEBEN!!!<br />
das bedeutet, dass der funktionsterm im quelltext eingegeben werden muss und das programm dadurch fast keinen nutzen hat.<br />
im quelltext wird der term wie folgt eingegeben:</p>
<pre><code class="language-cpp">float f(float x)
{
float f=sin(x*x); //EINGABE DES FUNKTIONSTERMS
return f;
}
</code></pre>
<p>das funktioniert natürlich auch, aber es wäre sehr viel nützlicher, wenn man in einem EditFeld einen funktionsterm eingeben könnte und dieser dann von programm verwendet würde.</p>
<p>hat vielleicht jemand eine idee oder einen quelltext, der dieses problem lösen kann; ich würde das programm nämlich sehr gerne zusammen mit meiner facharbeit abgeben (oberstufe).</p>
<p>schon einmal VIELEN LIEBEN DANK</p>
<p>gruß,<br />
dominik</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/129911/problem-bei-einem-mathe-funktionsplotter</link><generator>RSS for Node</generator><lastBuildDate>Thu, 30 Jul 2026 08:30:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/129911.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 17 Dec 2005 20:32:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to PROBLEM BEI EINEM MATHE-FUNKTIONSPLOTTER on Sat, 17 Dec 2005 20:34:31 GMT]]></title><description><![CDATA[<p>gute abend,<br />
ich bin noch recht unerfahren in C++ und habe heute mein erstes programm fertiggestellt: einen funktionsplottet der mathematische funktionen(2D) plottet.<br />
bis jetzt hat es auch für den anfang sehr gut geklappt und mein programm wäre fertig, wenn da nicht folgendes problem wäre:<br />
MAN KANN KEINEN EIGENEN FUNKTIONSTERM EINGEBEN!!!<br />
das bedeutet, dass der funktionsterm im quelltext eingegeben werden muss und das programm dadurch fast keinen nutzen hat.<br />
im quelltext wird der term wie folgt eingegeben:</p>
<pre><code class="language-cpp">float f(float x)
{
float f=sin(x*x); //EINGABE DES FUNKTIONSTERMS
return f;
}
</code></pre>
<p>das funktioniert natürlich auch, aber es wäre sehr viel nützlicher, wenn man in einem EditFeld einen funktionsterm eingeben könnte und dieser dann von programm verwendet würde.</p>
<p>hat vielleicht jemand eine idee oder einen quelltext, der dieses problem lösen kann; ich würde das programm nämlich sehr gerne zusammen mit meiner facharbeit abgeben (oberstufe).</p>
<p>schon einmal VIELEN LIEBEN DANK</p>
<p>gruß,<br />
dominik</p>
]]></description><link>https://www.c-plusplus.net/forum/post/944510</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/944510</guid><dc:creator><![CDATA[HobbyInformatiker]]></dc:creator><pubDate>Sat, 17 Dec 2005 20:34:31 GMT</pubDate></item><item><title><![CDATA[Reply to PROBLEM BEI EINEM MATHE-FUNKTIONSPLOTTER on Sat, 17 Dec 2005 20:41:59 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>das Thema hatten wir doch erst <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-128938-and-highlight-is-%2Aparser%2A.html" rel="nofollow">hier</a> vor kurzem.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/944516</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/944516</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sat, 17 Dec 2005 20:41:59 GMT</pubDate></item><item><title><![CDATA[Reply to PROBLEM BEI EINEM MATHE-FUNKTIONSPLOTTER on Sat, 17 Dec 2005 22:21:15 GMT]]></title><description><![CDATA[<p>danke für diesen verweis, ich habe darunter auch einen unübersehbaren link gefunden (<a href="http://swem.de/parser.htm" rel="nofollow">http://swem.de/parser.htm</a>). das ist GENAU das, was ich suche und brauche.<br />
allerdings ist die erklärung (*.pdf-format; ist in der datei &quot;fxypc.zip&quot; enthalten) ein böhmisches dorf für mich. ich habe versucht mit dieser erklärung die beiden dateien (&quot;Fnkt.h&quot; &amp; &quot;Fxypc.cpp&quot;) selbstständig einzubinden, allerding ohne jeglichen erfolg.<br />
kann mir jemand sagen, wie ich diese dateien in meine funktion einbinden muss (siehe meinen ersten post), so dass der funktionsterm in ein Edit-Fenster eingegeben werden kann und der wert f(x) für ein gegebenes x zurückgegeben wird???</p>
<p>vielen dank und ein schönes restwochenende!<br />
gruß,<br />
dominik</p>
]]></description><link>https://www.c-plusplus.net/forum/post/944560</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/944560</guid><dc:creator><![CDATA[HobbyInformatiker]]></dc:creator><pubDate>Sat, 17 Dec 2005 22:21:15 GMT</pubDate></item><item><title><![CDATA[Reply to PROBLEM BEI EINEM MATHE-FUNKTIONSPLOTTER on Sun, 18 Dec 2005 07:46:27 GMT]]></title><description><![CDATA[<p>DER CODE - MEIN PROBLEM <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /> :</p>
<pre><code>//---------------------------------------------------------------------------
#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------                                
#include&lt;stdio.h&gt;
#include&lt;string.h&gt;
#include&quot;fnkt.h&quot;

UserFunction::UserFunction()
{
 is_definded=FALSE;
 def_size=0;
 fcode=scode=NULL;
 fkonst=skonst=NULL;
}

UserFunction::~UserFunction()
{
 if(fcode)  { delete[] fcode;  }
 if(scode)  { delete[] scode;  }
 if(fkonst) { delete[] fkonst; }
 if(skonst) { delete[] skonst; }

}

UINT UserFunction::f_def(char *inbuf)
{

 is_definded=FALSE;

 def_size=strlen(inbuf);

 if(fcode) delete[] fcode;			
 fcode=new DWORD[def_size+50];
 if(!fcode) return(NO_MEM);

 if(scode) delete[] scode;
 scode=new DWORD[def_size+50];
 if(!scode) return(NO_MEM);

 if(fkonst) 	delete[] fkonst;	
 fkonst=new long double[def_size+50];
 if(!fkonst) return(NO_MEM);

 if(skonst) 	delete[] skonst;
 skonst=new long double[def_size+10];
 if(!skonst) return(NO_MEM);

 if(fwandel(inbuf)) return(SYNTAX_ERROR);

 is_definded=TRUE;

 return(TRUE);

}

long double UserFunction::calc(long double x, long double y)
{
 DWORD klamv,kanf,kend,z;
 DWORD vs;

 konstind=skonstind; codeind=scodeind; klamanz=sklamanz;
 for(z=0; z &lt; codeind; ++z)  fcode[z]=scode[z];
 for(z=0; z &lt; konstind; ++z) fkonst[z]=skonst[z];
 pritrans=spritrans; prihoch=sprihoch; primul=sprimul; priadd=spriadd;

 while( klamanz &gt; 0 )
 {
  klamv=kanf=kend=0;
  while( klamv != klamanz )
  {
   if( fcode[kanf] == fklamauf )
   {
    ++klamv;
   }
   ++kanf;
  }

  kend=kanf;
  while( fcode[kend] != fklamzu )  ++kend;

  vs=rechnen(kanf,kend,x,y);
  fcode[kanf-1]=nop;  fcode[kend-vs]=nop;
  ordnen();  --klamanz;

 }

 rechnen(0,codeind,x,y);

 if( fcode[0] == fcx )  return(x);
 else
 if( fcode[0] == fcy )  return(y);
 else                   return(fkonst[fcode[0&rsqb;&rsqb;);

}

DWORD UserFunction::rechnen(DWORD ranf,DWORD rend,long double x,long double y)
{
 DWORD l,vs;
 long double a,b;

 vs=0;

 if( pritrans &gt; 0 )
 {
  l=ranf;
  while( l &lt; rend )
  {
   switch(fcode[l])
   {
    case fsin:
             if( fcode[l+1]==fcx ) a=x;
             else
             if( fcode[l+1]==fcy ) a=y;
             else a=fkonst[fcode[l+1&rsqb;&rsqb;;
             fkonst[konstind]=sin(a);
             fcode[l]=konstind;    ++konstind;
             fcode[l+1]=nop; ++vs; --pritrans;
             l += 2;  ordnen(); --rend; break;
    case fcos:
             if( fcode[l+1]==fcx ) a=x;
             else
             if( fcode[l+1]==fcy ) a=y;
             else a=fkonst[fcode[l+1&rsqb;&rsqb;;
             fkonst[konstind]=cos(a);
             fcode[l]=konstind;      ++konstind;
             fcode[l+1]=nop;   ++vs; --pritrans;
             l += 2;  ordnen(); --rend; break;
    case ftan:
             if( fcode[l+1]==fcx ) a=x;
             else
             if( fcode[l+1]==fcy ) a=y;
             else a=fkonst[fcode[l+1&rsqb;&rsqb;;
             fkonst[konstind]=tan(a);
             fcode[l]=konstind;      ++konstind;
             fcode[l+1]=nop;  ++vs;  --pritrans;
             l += 2;  ordnen(); --rend; break;
    case fexp:
             if( fcode[l+1]==fcx ) a=x;
             else
             if( fcode[l+1]==fcy ) a=y;
             else a=fkonst[fcode[l+1&rsqb;&rsqb;;
             fkonst[konstind]=exp(a);
             fcode[l]=konstind;      ++konstind;
             fcode[l+1]=nop;   ++vs; --pritrans;
             l += 2;  ordnen(); --rend; break;
    case fln:
             if( fcode[l+1]==fcx ) a=x;
             else
             if( fcode[l+1]==fcy ) a=y;
             else a=fkonst[fcode[l+1&rsqb;&rsqb;;
             if(a &lt;= 0.0) a=1e-10;
             fkonst[konstind]=log(a);
             fcode[l]=konstind;      ++konstind;
             fcode[l+1]=nop;  ++vs;  --pritrans;
             l += 2;  ordnen(); --rend; break;
    case fsinh:
             if( fcode[l+1]==fcx ) a=x;
             else
             if( fcode[l+1]==fcy ) a=y;
             else a=fkonst[fcode[l+1&rsqb;&rsqb;;
             fkonst[konstind]=sinh(a);
             fcode[l]=konstind;     ++konstind;
             fcode[l+1]=nop; ++vs;  --pritrans;
             l += 2;  ordnen(); --rend; break;
    case fcosh:
             if( fcode[l+1]==fcx ) a=x;
             else
             if( fcode[l+1]==fcy ) a=y;
             else a=fkonst[fcode[l+1&rsqb;&rsqb;;
             fkonst[konstind]=cosh(a);
             fcode[l]=konstind;      ++konstind;
             fcode[l+1]=nop;   ++vs; --pritrans;
             l += 2;  ordnen(); --rend; break;
    case ftanh:
             if( fcode[l+1]==fcx ) a=x;
             else
             if( fcode[l+1]==fcy ) a=y;
             else a=fkonst[fcode[l+1&rsqb;&rsqb;;
             fkonst[konstind]=tanh(a);
             fcode[l]=konstind;      ++konstind;
             fcode[l+1]=nop;  ++vs;  --pritrans;
             l += 2;  ordnen(); --rend; break;
    case fasin:
             if( fcode[l+1]==fcx ) a=x;
             else
             if( fcode[l+1]==fcy ) a=y;
             else a=fkonst[fcode[l+1&rsqb;&rsqb;;
             fkonst[konstind]=asin(a);
             fcode[l]=konstind;      ++konstind;
             fcode[l+1]=nop;  ++vs;  --pritrans;
             l += 2;  ordnen(); --rend; break;
    case facos:
             if( fcode[l+1]==fcx ) a=x;
             else
             if( fcode[l+1]==fcy ) a=y;
             else a=fkonst[fcode[l+1&rsqb;&rsqb;;
             fkonst[konstind]=acos(a);
             fcode[l]=konstind;      ++konstind;
             fcode[l+1]=nop;  ++vs;  --pritrans;
             l += 2;  ordnen(); --rend; break;
    case fatan:
             if( fcode[l+1]==fcx ) a=x;
             else
             if( fcode[l+1]==fcy ) a=y;
             else a=fkonst[fcode[l+1&rsqb;&rsqb;;
             fkonst[konstind]=atan(a);
             fcode[l]=konstind;      ++konstind;
             fcode[l+1]=nop;  ++vs;  --pritrans;
             l += 2;  ordnen(); --rend; break;
    case fsqrt:
             if( fcode[l+1]==fcx ) a=x;
             else
             if( fcode[l+1]==fcy ) a=y;
             else a=fkonst[fcode[l+1&rsqb;&rsqb;;
             if(a &lt; 0) a =0;
             fkonst[konstind]=sqrt(a);
             fcode[l]=konstind;      ++konstind;
             fcode[l+1]=nop;  ++vs;  --pritrans;
             l += 2;  ordnen(); --rend; break;
    case fbet:
             if( fcode[l+1]==fcx ) a=x;
             else
             if( fcode[l+1]==fcy ) a=y;
             else a=fkonst[fcode[l+1&rsqb;&rsqb;;
	     fkonst[konstind]=fabs(a);
             fcode[l]=konstind;      ++konstind;
             fcode[l+1]=nop;   ++vs; --pritrans;
             l += 2;  ordnen(); --rend; break;
    default:
           ++l;
   }
  }
 }

 if( prihoch &gt; 0 )
 {
  l=ranf;
  while( l &lt; rend )
  {
   switch(fcode[l])
   {
    case fhoch:
             if( fcode[l-1]==fcx ) a=x;
             else
             if( fcode[l-1]==fcy ) a=y;
             else a=fkonst[fcode[l-1&rsqb;&rsqb;;
             if( fcode[l+1]==fcx ) b=x;
             else
             if( fcode[l+1]==fcy ) b=y;
             else b=fkonst[fcode[l+1&rsqb;&rsqb;;             
             fkonst[konstind]=pow(a,b);
             fcode[l]=konstind;  ++konstind;
             fcode[l-1]=nop; fcode[l+1]=nop;    --prihoch;
             ++l; vs += 2; ordnen(); rend -= 2; break;
    default:
           ++l;
   }
  }
 }

 if( primul &gt; 0 )
 {
  l=ranf;
  while( l &lt; rend )
  {
   switch(fcode[l])
   {
    case fdurch:
             if( fcode[l-1]==fcx ) a=x;
             else
             if( fcode[l-1]==fcy ) a=y;
             else a=fkonst[fcode[l-1&rsqb;&rsqb;;
             if( fcode[l+1]==fcx ) b=x;
             else
             if( fcode[l+1]==fcy ) b=y;
             else b=fkonst[fcode[l+1&rsqb;&rsqb;;
             if( b==0.0 ) b=1e-20;
             fkonst[konstind]=a/b;
             fcode[l]=konstind;  ++konstind;
             fcode[l-1]=nop; fcode[l+1]=nop; --primul;
             ordnen(); vs += 2; rend -= 2;   break;

    case fmal:
             if( fcode[l-1]==fcx ) a=x;
             else
             if( fcode[l-1]==fcy ) a=y;
             else a=fkonst[fcode[l-1&rsqb;&rsqb;;
             if( fcode[l+1]==fcx ) b=x;
             else
             if( fcode[l+1]==fcy ) b=y;
             else b=fkonst[fcode[l+1&rsqb;&rsqb;;
             fkonst[konstind]=a*b;
             fcode[l]=konstind;  ++konstind;
             fcode[l-1]=nop; fcode[l+1]=nop; --primul;
             ordnen();   vs += 2; rend -= 2; break;

    default:
           ++l;
   }
  }
 }

 if( priadd &gt; 0 )
 {
  l=ranf;
  while( l &lt; rend )
  {
   switch(fcode[l])
   {
    case fminus:
             if( (l==0) || (fcode[l-1]==fklamauf) )
             {
              if(fcode[l+1]==fcx) a=x;
              else
              if(fcode[l+1]==fcy) a=y;
              else
              if(fcode[l+1] &lt; 80) a=fkonst[fcode[l+1&rsqb;&rsqb;;
              fkonst[konstind]=-a;
              fcode[l]=konstind; ++konstind;  --priadd;
              fcode[l+1]=nop; ordnen(); ++vs; --rend; break;
             }
             else
             {
              if( fcode[l-1]==fcx ) a=x;
              else
              if( fcode[l-1]==fcy ) a=y;
              else a=fkonst[fcode[l-1&rsqb;&rsqb;;
              if( fcode[l+1]==fcx ) b=x;
              else
              if( fcode[l+1]==fcy ) b=y;
              else b=fkonst[fcode[l+1&rsqb;&rsqb;;
              fkonst[konstind]=a-b;
              fcode[l]=konstind;  ++konstind;
              fcode[l-1]=nop; fcode[l+1]=nop; --priadd;
              ordnen(); vs += 2; rend -= 2;   break;
             }

    case fplus:
             if( fcode[l-1]==fcx ) a=x;
             else
             if( fcode[l-1]==fcy ) a=y;
             else a=fkonst[fcode[l-1&rsqb;&rsqb;;
             if( fcode[l+1]==fcx ) b=x;
             else
             if( fcode[l+1]==fcy ) b=y;
             else b=fkonst[fcode[l+1&rsqb;&rsqb;;
             fkonst[konstind]=a+b;
             fcode[l]=konstind;  ++konstind;
             fcode[l-1]=nop; fcode[l+1]=nop; --priadd;
             ordnen(); vs += 2; rend -= 2;   break;

    default:
           ++l;
   }
  }
 }

 return(vs);
}

void UserFunction::ordnen(void)
{
 DWORD subzahl=0,oind1=0,oind2=0;
 DWORD zws[1000];

 while( oind1 &lt; codeind)
 {
  if(fcode[oind1] != (DWORD)nop) { zws[oind2]=fcode[oind1]; ++oind1; ++oind2; }
  else                    { ++oind1; ++subzahl;  }
 }

 codeind -= subzahl;

 for(oind1=0; oind1 &lt; codeind; ++oind1)  fcode[oind1]=zws[oind1];
}

DWORD UserFunction::fwandel(char *fstring)
{
 DWORD lenght,i;
 int   klamtest;
 char  qw[20],t;

 lenght=strlen(fstring);

 for(i=0; i &lt; lenght; scode[i++]=0);
 for(i=0; i &lt; lenght; skonst[i++]=0.0);
 spritrans=sprihoch=sprimul=spriadd=0;

 strind=skonstind=scodeind=sklamanz=0; klamtest=0;
 do
 {
  t=fstring[strind];
  if( (t &gt;= '0')&amp;&amp;(t &lt;='9')||(t=='.') )
  {
   i=0;
   while(((fstring[strind] &gt;='0')&amp;&amp;(fstring[strind]&lt;='9'))||fstring[strind]=='.')
   {
    qw[i]=fstring[strind];
    ++i;  ++strind;
   }
   qw[i]='\0';
   sscanf(qw,&quot;%lf&quot;,&amp;skonst[skonstind]);
   scode[scodeind]=skonstind;
   ++skonstind;  ++scodeind;
  }
  else
  if(t=='+'||t=='-'||t=='*'||t=='/'||t=='^'||t=='x'||t=='y'||t=='('||t==')')
  {
   switch(fstring[strind])
   {
    case '+':
            scode[scodeind]=fplus;    ++scodeind;  ++strind;
            ++spriadd;  break;
    case '-':
            scode[scodeind]=fminus;   ++scodeind;  ++strind;
            ++spriadd;  break;
    case '*':
            scode[scodeind]=fmal;     ++scodeind;  ++strind;
            ++sprimul;  break;
    case '/':
            scode[scodeind]=fdurch;   ++scodeind;  ++strind;
            ++sprimul;  break;
    case '^':
            scode[scodeind]=fhoch;    ++scodeind;  ++strind;
            ++sprihoch;  break;
    case 'x':
            scode[scodeind]=fcx;      ++scodeind;  ++strind;
            break;
    case 'y':
            scode[scodeind]=fcy;      ++scodeind;  ++strind;
            break;
    case '(':
            scode[scodeind]=fklamauf; ++scodeind;  ++strind;
            ++sklamanz;  ++klamtest; break;
    case ')':
            scode[scodeind]=fklamzu;  ++scodeind;  ++strind;
            --klamtest; break;
   }
  }
  else
  if( t=='s'||t=='c'||t=='t'||t=='e'||t=='l'||t=='a' )
  {
   if( (fstring[strind]=='s')&amp;&amp;(fstring[strind+1]=='i')
       &amp;&amp;(fstring[strind+2]=='n')&amp;&amp;(fstring[strind+3]=='h') )
   {
    scode[scodeind]=fsinh;   ++spritrans;
    strind += 4;  ++scodeind;
   }
   else
   if( (fstring[strind]=='c')&amp;&amp;(fstring[strind+1]=='o')
       &amp;&amp;(fstring[strind+2]=='s')&amp;&amp;(fstring[strind+3]=='h') )
   {
    scode[scodeind]=fcosh;   ++spritrans;
    strind += 4;  ++scodeind;
   }
   else
   if( (fstring[strind]=='t')&amp;&amp;(fstring[strind+1]=='a')
       &amp;&amp;(fstring[strind+2]=='n')&amp;&amp;(fstring[strind+3]=='h') )
   {
    scode[scodeind]=ftanh;  ++spritrans;
    strind += 4;  ++scodeind;
   }
   else
   if( (fstring[strind]=='a')&amp;&amp;(fstring[strind+1]=='s')
       &amp;&amp;(fstring[strind+2]=='i')&amp;&amp;(fstring[strind+3]=='n') )
   {
    scode[scodeind]=fasin;  ++spritrans;
    strind += 4;  ++scodeind;
   }
   else
   if( (fstring[strind]=='a')&amp;&amp;(fstring[strind+1]=='c')
       &amp;&amp;(fstring[strind+2]=='o')&amp;&amp;(fstring[strind+3]=='s') )
   {
    scode[scodeind]=facos;  ++spritrans;
    strind += 4;  ++scodeind;
   }
   else
   if( (fstring[strind]=='a')&amp;&amp;(fstring[strind+1]=='t')
       &amp;&amp;(fstring[strind+2]=='a')&amp;&amp;(fstring[strind+3]=='n') )
   {
    scode[scodeind]=fatan;  ++spritrans;
    strind += 4;  ++scodeind;
   }
   else
   if( (fstring[strind]=='s')&amp;&amp;(fstring[strind+1]=='q')
       &amp;&amp;(fstring[strind+2]=='r')&amp;&amp;(fstring[strind+3]=='t') )
   {
    scode[scodeind]=fsqrt;  ++spritrans;
    strind += 4;  ++scodeind;
   }
   else
   if( (fstring[strind]=='a')&amp;&amp;(fstring[strind+1]=='b')
       &amp;&amp;(fstring[strind+2]=='s') )
   {
    scode[scodeind]=fbet;    ++spritrans;
    strind += 3;  ++scodeind;
   }
   else
   if( (fstring[strind]=='s')&amp;&amp;(fstring[strind+1]=='i')
       &amp;&amp;(fstring[strind+2]=='n') )
   {
    scode[scodeind]=fsin;    ++spritrans;
    strind += 3;  ++scodeind;
   }
   else
   if( (fstring[strind]=='c')&amp;&amp;(fstring[strind+1]=='o')
       &amp;&amp;(fstring[strind+2]=='s') )
   {
    scode[scodeind]=fcos;     ++spritrans;
    strind += 3;  ++scodeind;
   }
   else
   if( (fstring[strind]=='t')&amp;&amp;(fstring[strind+1]=='a')
       &amp;&amp;(fstring[strind+2]=='n') )
   {
    scode[scodeind]=ftan;     ++spritrans;
    strind += 3;  ++scodeind;
   }
   else
   if( (fstring[strind]=='e')&amp;&amp;(fstring[strind+1]=='x')
       &amp;&amp;(fstring[strind+2]=='p') )
   {
    scode[scodeind]=fexp;     ++spritrans;
    strind += 3;  ++scodeind;
   }
   else
   if( (fstring[strind]=='l')&amp;&amp;(fstring[strind+1]=='n') )
   {
    scode[scodeind]=fln;      ++spritrans;
    strind += 2;  ++scodeind;
   }
   else  ++strind;
  }
  else  ++strind;
 }
 while(strind &lt; def_size);

 return(klamtest);
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{

//?????????????????????????????????????????

}
//---------------------------------------------------------------------------
</code></pre>
<p>Diesen Code habe ich runtergeladen (<a href="http://swem.de/parser.htm" rel="nofollow">http://swem.de/parser.htm</a>) und ich möchte, dass wenn der Button1 geklickt wird, dass dann für 2 vergegebene &quot;zahlen&quot; der funktionswert ausgegeben wird, wobei ich den funktionsterm noch (ich glaube als &quot;str&quot; - das ist ja der sinn der sache) angeben muss.</p>
<p>WIE DEKLARIERE IST DAS IN DER FUNKTION &quot;Button1Click&quot;????????????????????</p>
<p>vielen danke<br />
gruß,<br />
dominik</p>
]]></description><link>https://www.c-plusplus.net/forum/post/944646</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/944646</guid><dc:creator><![CDATA[HobbyInformatiker]]></dc:creator><pubDate>Sun, 18 Dec 2005 07:46:27 GMT</pubDate></item><item><title><![CDATA[Reply to PROBLEM BEI EINEM MATHE-FUNKTIONSPLOTTER on Mon, 26 Dec 2005 21:14:38 GMT]]></title><description><![CDATA[<p>HobbyInformatiker schrieb:</p>
<blockquote>
<p>WIE DEKLARIERE IST DAS IN DER FUNKTION &quot;Button1Click&quot;????????????????????</p>
</blockquote>
<p>?(???????)<br />
War das jetzt ein deutscher Satz?</p>
<p>Also: Was du machen musst, steht in der von dir angeführten PDF auf Seite 2. Da ist sogar ein Quelltextbeispiel.</p>
<p>Was ist dein genaues Problem bzw. welche genauen Fehler treten auf?</p>
<p>[EDIT]<br />
Nachtrag: In dem Beispiel ist meines Erachtens nach aber ein Fehler: in der äußeren for-Schleife sollte auch y als Vergleichs- bzw. Inkrementationswert dienen.<br />
[/EDIT]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/950434</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/950434</guid><dc:creator><![CDATA[Dasd]]></dc:creator><pubDate>Mon, 26 Dec 2005 21:14:38 GMT</pubDate></item><item><title><![CDATA[Reply to PROBLEM BEI EINEM MATHE-FUNKTIONSPLOTTER on Wed, 28 Dec 2005 21:14:37 GMT]]></title><description><![CDATA[<p>Ich schlage vor, du machst dir ein neues leeres Projekt.<br />
Auf das Formular legst du ein Eingabefeld (Edit1), ein Memofeld (Memo1) und einen Button (Button1).<br />
Du musst dann nur noch die cpp-Datei zum Projekt hinzufügen.</p>
<p>Dann ersetzt du die Code in der Datei unit1.cpp durch den folgenden:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#include &lt;stdio.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
#include &quot;fnkt.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
UserFunction myFnkt;
//
//
//
//
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
Edit1-&gt;Text=&quot;exp(x)&quot;; //Beispiel
}
//
//
//
//
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString fktstr;
AnsiString memostr;
bool bReturn;
char szMemoText[255];
fktstr=Edit1-&gt;Text;
double xwert=0;
double ywert=0;
double zwert=0;
bReturn=myFnkt.f_def(fktstr.c_str());
if (bReturn)
  {
  Memo1-&gt;Lines-&gt;Add(fktstr.c_str());
  if (myFnkt.is_definded) //Fehler im Parser-Code (is_definded statt is_defined)
    {
    //Die Funktionsgrenzen müssten natürlich auch variabel sein.
    //Das ist aber wohl keine Problem
    for (xwert=0.0; xwert&lt;=10.0; xwert=xwert+1.0)
      {
      zwert=myFnkt.calc(xwert);
      //zwert=myFnkt.calc(xwert, ywert); //Für komplexere Funktionen
      sprintf(szMemoText, &quot;x=%f : y=%f&quot;, xwert, zwert);
      Memo1-&gt;Lines-&gt;Add(szMemoText);
      }
    }
  else
    {
    Memo1-&gt;Lines-&gt;Add(&quot;Fehler: Not defined&quot;);
    }
  }
else
  {
  Memo1-&gt;Lines-&gt;Add(&quot;Fehler: Parser&quot;);
  }
}
</code></pre>
<p>Beachte: der Parser-Code enthält mindestens zwei Fehler:</p>
<p>(1) &quot;isdefinded&quot; statt &quot;isdefined&quot;<br />
Da gibt es ein wenig durcheinander in der Dokumentation und im Quellcode.<br />
(2) Die Winkelfunktionen erwarten die Parameter im Bogenmaß.<br />
Auf den ersten Blick sieht es so aus als würde dies durch deinen Parser-Code<br />
nicht berücksicht. Du müsstest die Umrechnung in allen Winkelfunktionen in<br />
den case-Blöcken einfügen, da du ja bestimmt mit normalen kartesischen<br />
Koordinaten arbeiten möchtest.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/951790</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/951790</guid><dc:creator><![CDATA[barnie]]></dc:creator><pubDate>Wed, 28 Dec 2005 21:14:37 GMT</pubDate></item><item><title><![CDATA[Reply to PROBLEM BEI EINEM MATHE-FUNKTIONSPLOTTER on Fri, 30 Dec 2005 14:16:37 GMT]]></title><description><![CDATA[<p>Der Parser-Code enthält einen weiteren Fehler.<br />
Vielleicht sollte auf dieses Beispiel <strong>nicht mehr verwiesen</strong> werden.</p>
<p>Er verarbeitet einfache Summen f(x)=x+1 oder f(x)=sin(x)+1 nicht.<br />
Der Auswertung der Zahlen läuft anscheinend schief, den f(x)=sin(x)+sin(x) funktioniert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/952770</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/952770</guid><dc:creator><![CDATA[barnie]]></dc:creator><pubDate>Fri, 30 Dec 2005 14:16:37 GMT</pubDate></item></channel></rss>