[問題] 如何將資料寫到excel的第二行

看板C_and_CPP (C/C++)作者 (watson)時間12年前 (2013/12/11 17:53), 編輯推噓0(003)
留言3則, 2人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) vc++ 6.0 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): #include "stdafx.h" #include <iostream.h> #include <fstream.h> #include <string.h> #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <time.h> int main(int argc, char* argv[]) { ofstream File1; clock_t t1, t2; File1.open("C:\\File1.xls"); for(int j=0; j<=15 ; j++) { t1 = clock(); Sleep(1000); // t2 = clock(); printf("%lf\n", (t1)/(double)(CLOCKS_PER_SEC)); File1 << (t1)/(double)(CLOCKS_PER_SEC) <<endl; cout << "寫入Data值: "<< (t1)/(double)(CLOCKS_PER_SEC) << "完成!" <<endl; } system("pause"); return 0; } 我有拍圖片 http://ppt.cc/WiR5 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.124.249.111

12/11 19:13, , 1F
謝謝Billy 搞定了 ^^
12/11 19:13, 1F

12/11 19:13, , 2F
在後面加個 "\t" 就可以換行了
12/11 19:13, 2F

12/12 11:32, , 3F
這樣寫應該是存csv吧。
12/12 11:32, 3F
文章代碼(AID): #1Ig3OTek (C_and_CPP)
文章代碼(AID): #1Ig3OTek (C_and_CPP)