Advertisement
Guest User

Untitled

a guest
Feb 8th, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 0.72 KB | None | 0 0
  1.  struct point{
  2.      string names;
  3.      int x; int y; int z;
  4. }
  5. void main(string[] args) {
  6.    
  7.     point a= point();point b= point();point c= point();
  8.     a.names = "First"; a.x = 1; a.y = a.x + 12; a.z = 14;
  9.     b.names = "Second"; b.x = (int)Math.sqrt(7); b.y = a.x * a.y; b.z = b.y + b.x;
  10.     c.names = "Third"; c.x = 542; c.y = a.x; c.z = b.z * a.y + c.y / c.x;
  11.  
  12.     File file = File.new_for_path ("test.csv");
  13.    
  14.     FileOutputStream os = file.create (FileCreateFlags.PRIVATE);
  15.     os.write ("%s, %d, %d, %d,\n".printf( a.names, a.x, a.y, a.z).data);
  16.     os.write ("%s, %d, %d, %d,\n".printf( b.names, b.x, b.y, b.z).data);
  17.     os.write ("%s, %d, %d, %d,\n".printf( c.names, c.x, c.y, c.z).data);
  18.  
  19.     print ("Created.\n");
  20.  
  21.  
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement