[問題] 靜態區域變數設值問題
我想由筆記本資料為靜態區域變數設值
該怎麼做呢?
舉例程式如下:
#include <iostream>
#include <cstdlib>
#include <vector>
#include <fstream>
#include <cstdio>
#include <string>
#include <sstream>
#include <ctime>
#include "Sphere.h"
using namespace std;
double Spherocylinder::LowerX = 0; 我想由筆記本資料將以下幾個靜態
double Spherocylinder::UpperX = 100; 區域變數設值.像底下main裡面的變數的
double Spherocylinder::LowerY = 0; 做法.
double Spherocylinder::UpperY = 100;
double Spherocylinder::k_rod = 0.01;
double Spherocylinder::k_wall = 0.08;
double Spherocylinder::ViscousConstant_t = 1.0;
double Spherocylinder::ViscousConstant_r = 1.5;
int main()
{
double rho, width, L, rate, truncation, division, total, TimeStep;
double x0, x1, y0, y1, kr, kw, viscous_t, viscous_r;
ifstream parameter ("C:\\Documents and Settings\\luckychild137\\My
Documents\\Visual Studio 2010\\Projects\\
RodSphereMixture_08_20_2010\\Rod_08_20_2010\\
RodData.txt", ios::in);
char comment[20];
parameter >> rho; parameter.getline(comment,20);
parameter >> width; parameter.getline(comment,20);
parameter >> L; parameter.getline(comment,20);
以下省略!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.120.11.63
→
08/20 23:48, , 1F
08/20 23:48, 1F
→
08/20 23:49, , 2F
08/20 23:49, 2F
→
08/20 23:49, , 3F
08/20 23:49, 3F
→
08/20 23:49, , 4F
08/20 23:49, 4F
→
08/20 23:50, , 5F
08/20 23:50, 5F
→
08/20 23:50, , 6F
08/20 23:50, 6F
→
08/20 23:51, , 7F
08/20 23:51, 7F
→
08/20 23:54, , 8F
08/20 23:54, 8F
→
08/20 23:54, , 9F
08/20 23:54, 9F
→
08/20 23:55, , 10F
08/20 23:55, 10F
→
08/20 23:56, , 11F
08/20 23:56, 11F
→
08/20 23:57, , 12F
08/20 23:57, 12F
→
08/20 23:59, , 13F
08/20 23:59, 13F
→
08/21 00:01, , 14F
08/21 00:01, 14F
→
08/21 00:10, , 15F
08/21 00:10, 15F
推
08/21 00:13, , 16F
08/21 00:13, 16F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章