fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <fstream>
  4. using namespace std;
  5.  
  6. int main() {
  7. ofstream file("data.txt");
  8. for (double x = -10; x <= 10; x += 0.1) {
  9. double y = x * x; // هنا الدالة y = x^2
  10. file << x << " " << y << endl;
  11. }
  12. file.close();
  13.  
  14. // استدعاء gnuplot لرسم البيانات
  15. system("gnuplot -p -e \"plot 'data.txt' with lines title 'y = x^2'\"");
  16.  
  17. return 0;
  18. }
Success #stdin #stdout #stderr 0.01s 5316KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
sh: 1: gnuplot: not found