java übersetzen in c++



  • hi, bin nicht so der c++ experte und wollte mal fragen ob jemand mir bei der übersetzung helfen kann.?

    Möge die macht mit dir sein!

    double[] x = new double[5];
           double[] y = new double[5];
                  try {
               RandomAccessFile f;
               f = new RandomAccessFile("c:/test.txt", "r");
               String line;
               int knoten = 0;
               int s = 0;
               int q = 0;
    
               while ((line = f.readLine()) != null) {
                   if (line.startsWith("DIMENSION")) {
                       knoten = Integer.parseInt(line.substring(12));
                   }
    
                                  String d = null;
                   String e = null;
    
                   String[] t = line.split(" ");
    
                   for (int i = 0; i < t.length; i++) {
                       if (t[i].length() == 10) {
                           d = t[i];
                           x[s++] = Double.parseDouble(d);
                           i++;
                           e = t[i];
                           y[q++] = Double.parseDouble(e);
                       }
    


  • zu arrays der ersten dimension
    http://www.volkard.de/vcppkold/arrays_und_zeiger.html

    zu umwandlung von datentypen
    im c++ faq: einmal string nach int und zurück


Anmelden zum Antworten