Advertisement
Guest User

Untitled

a guest
Feb 8th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 0.69 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.replace (null, false, FileCreateFlags.PRIVATE);
  15.  
  16.     os.write(@"$(a.names), $(a.x), $(a.y), $(a.z)".data);
  17.     os.write(@"$(a.names), $(b.x), $(b.y), $(b.z)".data);
  18.     os.write(@"$(a.names), $(c.x), $(c.y), $(c.z)".data);
  19.  
  20.  
  21.     print ("Created.\n");
  22.  
  23.  
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement