<?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[unklare frage, evtl was mit arrays (war: Hilfe)]]></title><description><![CDATA[<p>ich bräucht mal einen rat!!!!ich hab ein programm erstellt um die kürzeste strecke von 3 punkten zu berechnen-funktioniert auch schon mal ganz gut!jez hab ich aber eine tabelle im editor abgespeichert mit 5 verschiedenen punkten und jez will ich in der eingabeaufforderung auf die tabelle zugreifen,das hab ich auch schon geschafft-jez aber meine frage----wie kann ich auf drei ganz bestimmte punkte aus der tabelle zugreifen zum beispiel auf punkt 1,3,4?weiß das jemand wie ich das dem computer sagen kann? bitte helft mir-ich weiß nimmer weiter,weil der computer immer automatisch die ersten drei punkte aus der tabelle berechnet und nich die drei die ich brauch! mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/127777/unklare-frage-evtl-was-mit-arrays-war-hilfe</link><generator>RSS for Node</generator><lastBuildDate>Tue, 25 Aug 2026 05:14:31 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/127777.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 27 Nov 2005 13:02:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to unklare frage, evtl was mit arrays (war: Hilfe) on Sun, 27 Nov 2005 13:56:18 GMT]]></title><description><![CDATA[<p>ich bräucht mal einen rat!!!!ich hab ein programm erstellt um die kürzeste strecke von 3 punkten zu berechnen-funktioniert auch schon mal ganz gut!jez hab ich aber eine tabelle im editor abgespeichert mit 5 verschiedenen punkten und jez will ich in der eingabeaufforderung auf die tabelle zugreifen,das hab ich auch schon geschafft-jez aber meine frage----wie kann ich auf drei ganz bestimmte punkte aus der tabelle zugreifen zum beispiel auf punkt 1,3,4?weiß das jemand wie ich das dem computer sagen kann? bitte helft mir-ich weiß nimmer weiter,weil der computer immer automatisch die ersten drei punkte aus der tabelle berechnet und nich die drei die ich brauch! mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/928288</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/928288</guid><dc:creator><![CDATA[Martina84]]></dc:creator><pubDate>Sun, 27 Nov 2005 13:56:18 GMT</pubDate></item><item><title><![CDATA[Reply to unklare frage, evtl was mit arrays (war: Hilfe) on Sun, 27 Nov 2005 13:23:18 GMT]]></title><description><![CDATA[<p>Martina84 schrieb:</p>
<blockquote>
<p>jez hab ich aber eine tabelle im editor abgespeichert</p>
</blockquote>
<p>Wie muss man sich diese &quot;tabelle im editor&quot; denn vorstellen? Sprich, wie hast du die Werte letztendlich abgespeichert? Und nach welchen Kriterien bestimmst du die Punkte, die für die Berechnung herangezogen werden sollen?</p>
<p>btw:<br />
In Zukunft bitte aussagekräftige Titel verwenden. Und dass deine Ausrufezeichentaste klemmt hilft da auch nicht weiter.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/928301</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/928301</guid><dc:creator><![CDATA[groovemaster]]></dc:creator><pubDate>Sun, 27 Nov 2005 13:23:18 GMT</pubDate></item><item><title><![CDATA[Reply to unklare frage, evtl was mit arrays (war: Hilfe) on Sun, 27 Nov 2005 13:52:42 GMT]]></title><description><![CDATA[<p>meine tabelle im editor sieht wie folgt aus:</p>
<p>8012002 3512352.99 5328150.45 Hochheim TP<br />
8011199 3514587.54 5328225.91 Tiefheim TP<br />
8012010 3512674.77 5328450.41 Oberdorf AP<br />
8013088 3513773.23 5328550.86 Unterdorf AP<br />
8014111 3512987.38 5328725.03 Bahnhof PP</p>
<p>jez möchte ich aber nur die strecke von punkt 1 ,3 und 4 berechnen,wenn ich aber in der eingabeaufforderung die tabelle einles,wird nurd nur die strecke von punkt 1,2,3 berechnet!wie sag ich das denn jez dass ich punkte 1,3,4 haben will??? vlg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/928335</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/928335</guid><dc:creator><![CDATA[Martin84]]></dc:creator><pubDate>Sun, 27 Nov 2005 13:52:42 GMT</pubDate></item><item><title><![CDATA[Reply to unklare frage, evtl was mit arrays (war: Hilfe) on Sun, 27 Nov 2005 14:00:04 GMT]]></title><description><![CDATA[<p>meine tabelle war übrigens vorgegeben,also nich von mir erstellt!meine aufgabe war dann aus der tabelle über mein programm die punkte 1,3,4 zu vergleichen und die kürzeste strecke zu ermitteln</p>
]]></description><link>https://www.c-plusplus.net/forum/post/928342</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/928342</guid><dc:creator><![CDATA[Martina84]]></dc:creator><pubDate>Sun, 27 Nov 2005 14:00:04 GMT</pubDate></item><item><title><![CDATA[Reply to unklare frage, evtl was mit arrays (war: Hilfe) on Sun, 27 Nov 2005 14:10:26 GMT]]></title><description><![CDATA[<p>Wenn du jetzt noch erklärst was die einzelnen Felder der Tabelle bedeuten und wie mann daraus eine Entfernung berechnet kommen wir der Lösung schon näher.<br />
Kurt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/928346</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/928346</guid><dc:creator><![CDATA[ZuK]]></dc:creator><pubDate>Sun, 27 Nov 2005 14:10:26 GMT</pubDate></item><item><title><![CDATA[Reply to unklare frage, evtl was mit arrays (war: Hilfe) on Sun, 27 Nov 2005 14:20:42 GMT]]></title><description><![CDATA[<p>also nochmal die ganze tabelle:</p>
<p>Punkt-nr. y x Punktlage Vermarkung</p>
<p>8012002 3512352.99 5328150.45 Hochheim TP<br />
8011199 3514587.54 5328225.91 Tiefheim TP<br />
8012010 3512674.77 5328450.41 Oberdorf AP<br />
8013088 3513773.23 5328550.86 Unterdorf AP<br />
8014111 3512987.38 5328725.03 Bahnhof PP</p>
<p>also berechenen kann ich ja die strecken über den pythagoras und dazu will ich die verschiedenen Punkte aus der tabelle benutzen und nochmal mein problem dazu:ich weiß einfach nich wie ich dem pc sag dass ich zum beispiel die punktnumern 8012002 ;8013088 und 8014111 berechnen will! das muss doch irgendwie möglich sein bestimmte elemente der tabelle zu benutzen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/928358</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/928358</guid><dc:creator><![CDATA[Martina84]]></dc:creator><pubDate>Sun, 27 Nov 2005 14:20:42 GMT</pubDate></item><item><title><![CDATA[Reply to unklare frage, evtl was mit arrays (war: Hilfe) on Sun, 27 Nov 2005 15:36:28 GMT]]></title><description><![CDATA[<p>Weiss nicht wie ich das erklären soll.<br />
Vielleicht hilft dir etwas code weiter.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;sstream&gt;
#include &lt;cmath&gt;

using namespace std;

struct record {
    int   id;
    double x;
    double y;
    string Vermarkung;
    string show() { return Vermarkung; }
};

class table {
public:
   table( const char * fname ) { read_table( fname ); }
   bool find_rec( int id, record &amp; rec  );  
protected:
   void read_table( const char * fname);
   vector&lt;record&gt; records;   
};

void table::read_table( const char * fname ) {
   string line;
   ifstream in( fname );
   if ( ! in.good() ) {
      cout &lt;&lt; &quot;tabelle &quot; &lt;&lt; fname &lt;&lt; &quot; nicht gefunden.&quot;;
      return;
   }
   while ( getline( in, line ) ) {
      // cout &lt;&lt; line &lt;&lt; endl;
      record rec;
      stringstream str(line);
      str &gt;&gt; rec.id &gt;&gt; rec.x &gt;&gt; rec.y ;      
      size_t p = str.tellg();
      if ( p != string::npos ) {
         while ( p &lt; line.length() &amp;&amp; line[p] == ' ' ) p++;
         rec.Vermarkung = line.substr( p );
      }
      records.push_back( rec );
   }
}

bool table::find_rec( int id, record &amp; rec  )  {
   // cout &lt;&lt; &quot;looking up record &quot; &lt;&lt; id &lt;&lt; endl;
   for( vector&lt;record&gt;::const_iterator i = records.begin(); i != records.end(); ++i ) {
      if ( (*i).id == id ) {
          rec = *i;
	  return true;
      }
   }
   cout &lt;&lt; &quot;record with id &quot; &lt;&lt; id &lt;&lt; &quot; not found.&quot; &lt;&lt; endl;
   return false;
}

void usage( const char * progname ) {
   cout &lt;&lt; &quot;usage:&quot; &lt;&lt; endl;
   cout &lt;&lt; &quot; &quot; &lt;&lt; progname &lt;&lt; &quot; tabelle id1 id2&quot; &lt;&lt; endl;
}

int str_to_id( const char * s ) {
   int ret;
   stringstream str(s);
   str &gt;&gt; ret;
   return ret;
}

int main( int argc, char ** argv ) {
   if ( argc &lt; 4 ) {
      usage( argv[0] );
      return 1;
   }
   table tabelle( argv[1] );
   record r1;
   record r2;
   if ( tabelle.find_rec( str_to_id(argv[2]), r1 ) &amp;&amp; tabelle.find_rec( str_to_id(argv[3]), r2 ) ) {
       double dx = r1.x - r2.x;
       double dy = r1.y - r2.y;
       cout &lt;&lt; &quot;distance between '&quot; &lt;&lt; r1.show() &lt;&lt; &quot;' and '&quot; &lt;&lt; r2.show() &lt;&lt; &quot;' is &quot; &lt;&lt; sqrt(dx*dx + dy*dy ) &lt;&lt; &quot; km&quot; &lt;&lt; endl; 
   }
   return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/928421</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/928421</guid><dc:creator><![CDATA[ZuK]]></dc:creator><pubDate>Sun, 27 Nov 2005 15:36:28 GMT</pubDate></item><item><title><![CDATA[Reply to unklare frage, evtl was mit arrays (war: Hilfe) on Sun, 27 Nov 2005 16:15:06 GMT]]></title><description><![CDATA[<p>ok,vielen dank für die mühe-ich werds mal so probieren</p>
]]></description><link>https://www.c-plusplus.net/forum/post/928447</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/928447</guid><dc:creator><![CDATA[Martina84]]></dc:creator><pubDate>Sun, 27 Nov 2005 16:15:06 GMT</pubDate></item></channel></rss>