当前位置: 首页>>代码示例>>C++>>正文


C++ stringstream::precision方法代码示例

本文整理汇总了C++中stringstream::precision方法的典型用法代码示例。如果您正苦于以下问题:C++ stringstream::precision方法的具体用法?C++ stringstream::precision怎么用?C++ stringstream::precision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在stringstream的用法示例。


在下文中一共展示了stringstream::precision方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: process

int process ( ifstream & ifile, ofstream & log, earthquake & EQ ) {
    stringstream str, str2;
    str.precision ( 3 );
    str << "# " << EQ.get_day () << " " << EQ.get_month_str () << " "
    << EQ.get_year () << " " << setfill ('0') << setw ( 2 ) << EQ.get_hour ()
    << ":" << setfill ( '0' ) << setw ( 2 ) << EQ.get_min () << ":" << setfill ( '0' )
    << setw ( 2 ) << EQ.get_sec () << '.' << setfill( '0' ) << setw ( 3 )
    << setprecision ( 0 ) << fixed << EQ.get_ms () << " " << EQ.tz
    << " " << EQ.get_magnitude_Type_str () << " " << fixed
    << setprecision ( 1 ) << EQ.get_magnitude () << " "
    << EQ.earthquake_name << " [" << EQ.id << "] (" << setprecision ( 2 )
    << fixed << EQ.get_lon () << ", " << fixed << EQ.get_lat ()
    << ", " << setprecision ( 1 ) << EQ.get_elv () << ")" << endl;
    
    EQ.sign = 0;
    
    for ( int i = 0; i < EQ.valid; i++ ) {
        string s = EQ.stations[i].get_orientation();
        unsigned int n = s.size();
        for ( size_t j = 0; j < n; j++ ) {
            str2 << EQ.id << '.'
            << EQ.stations[i].get_network_code_str () << '.'
            << EQ.stations[i].get_station_name () << '.'
            << EQ.stations[i].get_type_of_band_str ()
            << EQ.stations[i].get_type_of_instrument_str ()
            << s[j] << endl;
            EQ.sign++;
        }
    }
    
    str << EQ.sign << endl;
    print ( log, str, true );
    print ( log, str2, true );
    return 0;
}
开发者ID:Shima63,项目名称:Earthquakes-Analysis-Collaborative,代码行数:35,代码来源:amir.philip.shima.cpp

示例2: main

int main()
{
  ios_base::sync_with_stdio(0); cout.precision(output_precision); cout << fixed;
  ss.precision(output_precision); ss << fixed;
  cin >> N >> X0 >> Y0 >> C;
  if (C == 1) 
  {
    cout << 0 << endl;
    return 0;
  }
  else
  {
    ll bad  = 0;
    ll good = N*2;
    while (bad+1<good)
    {
      ll s = (good+bad)>>1;
      ll sum = 0;
      sum += f(s,X0,Y0);
      sum += f(s,X0,N-Y0+1);
      sum += f(s,N-X0+1,Y0);
      sum += f(s,N-X0+1,N-Y0+1);
      sum -= min(N-X0+1, s+1);
      sum -= min(N-Y0+1, s+1);
      sum -= min(X0, s+1);
      sum -= min(Y0, s+1);
      sum++;
      assert(sum >= 0);
      if (sum < C) bad = s;
      else good = s;
    }
    cout << good << endl;
    return 0;
  }
}
开发者ID:hidenori-shinohara,项目名称:codeforces,代码行数:35,代码来源:B.cpp

示例3: main

int main()
{
  ios_base::sync_with_stdio(0); cout.precision(output_precision); cout << fixed;
  ss.precision(output_precision); ss << fixed;
  cin >> N >> Q;
  segTree st;
  st.init(N);
  rep1(i,N) st.add(i,1);
//  rep1(i,N) db(st.query(i,i));
//  rep1(i,N) st.add(i,1);
//  rep1(i,N) db(st.query(i,N));
  int leftMost = 1;
  vector<int> ans;
//  st.print(leftMost);
  rep1(q,Q)
  {
    int t, p, l, r;
    cin >> t;
    switch(t)
    {
      case 1:
        cin >> p;
        rep1(k,p)
          st.add(leftMost+2*p-k,st.query(leftMost+k-1,leftMost+k-1));
        leftMost += p;
//        st.print(leftMost);
        break;
      case 2:
        cin >> l >> r;
        ans.pb(st.query(leftMost+l, leftMost+r-1));
        break;
    }
  }
开发者ID:hidenori-shinohara,项目名称:codeforces,代码行数:33,代码来源:C.cpp

示例4: main

int main()
{
  ios_base::sync_with_stdio(0); cout.precision(output_precision); cout << fixed;
  ss.precision(output_precision); ss << fixed;
  set<int> st;
  rep1(i, 100) st.insert(i);

}
开发者ID:hidenori-shinohara,项目名称:codeforces,代码行数:8,代码来源:A.cpp

示例5: main

int main()
{
  ios_base::sync_with_stdio(0); cout.precision(output_precision); cout << fixed;
  ss.precision(output_precision); ss << fixed;
  cin >> N >> M >> K;
  rep1(i,M)
  {
    cin >> X[i];
  }
开发者ID:hidenori-shinohara,项目名称:codeforces,代码行数:9,代码来源:B.cpp

示例6: dtype_min

// Print the minimum value of 'dtype'
void dtype_min(bh_type dtype, stringstream &out)
{
    if (bh_type_is_integer(dtype)) {
        out << bh_type_limit_min_integer(dtype);
    } else {
        out.precision(std::numeric_limits<double>::max_digits10);
        out << bh_type_limit_min_float(dtype);
    }
}
开发者ID:omegahm,项目名称:bohrium,代码行数:10,代码来源:main.cpp

示例7: main

int main()
{
    ios_base::sync_with_stdio(0);
    cout.precision(output_precision);
    cout << fixed;
    ss.precision(output_precision);
    ss << fixed;
    __gcd(0,3);
}
开发者ID:hidenori-shinohara,项目名称:codeforces,代码行数:9,代码来源:A.cpp

示例8: main

int main()
{
  ios_base::sync_with_stdio(0); cout.precision(output_precision); cout << fixed;
  ss.precision(output_precision); ss << fixed;
  cin >> N;
  rep1(i,N)
  {
    cin >> s[i];
    s[i] = " " + s[i] + " ";
  }
开发者ID:hidenori-shinohara,项目名称:codeforces,代码行数:10,代码来源:A.cpp

示例9: main

int main()
{
  ios_base::sync_with_stdio(0); cout.precision(output_precision); cout << fixed;
  ss.precision(output_precision); ss << fixed;
  cin >> N;
  rep1(i,N) 
  {
    cin >> A[i];
    inv[A[i]]=i;
  }
开发者ID:hidenori-shinohara,项目名称:codeforces,代码行数:10,代码来源:C.cpp

示例10: main

int main()
{
    ios_base::sync_with_stdio(0); cout.precision(output_precision); cout << fixed;
    ss.precision(output_precision); ss << fixed;
    cin >> s;
    N = s.size();
    s = " " + s;
//    db(s[N]-'0');
//    rep1(i, N) db(s[i]);
    cout << dp(N, 0) << endl;
}
开发者ID:hidenori-shinohara,项目名称:codeforces,代码行数:11,代码来源:D.cpp

示例11: main

int main()
{
  ios_base::sync_with_stdio(0); cout.precision(output_precision); cout << fixed;
  ss.precision(output_precision); ss << fixed;
  cin >> N;
  rep1(i,N)
  {
    int foo;
    cin >> foo;
    mx = max(foo,mx);
  }
开发者ID:hidenori-shinohara,项目名称:codeforces,代码行数:11,代码来源:B.cpp

示例12: dtype_max

// Print the maximum value of 'dtype'
void dtype_max(bh_type dtype, stringstream &out)
{
    if (bh_type_is_integer(dtype)) {
        out << bh_type_limit_max_integer(dtype);
        if (not bh_type_is_signed_integer(dtype)) {
            out << "u";
        }
    } else {
        out.precision(std::numeric_limits<double>::max_digits10);
        out << bh_type_limit_max_float(dtype);
    }
}
开发者ID:omegahm,项目名称:bohrium,代码行数:13,代码来源:main.cpp

示例13: main

int main()
{
  ios_base::sync_with_stdio(0); cout.precision(output_precision); cout << fixed;
  ss.precision(output_precision); ss << fixed;
  cin >> N;
  rep1(i, N) 
  {
    int foo, bar;
    cin >> foo >> bar;
    ans |= foo!=bar;

  }
开发者ID:hidenori-shinohara,项目名称:codeforces,代码行数:12,代码来源:A.cpp

示例14: main

int main()
{
  ios_base::sync_with_stdio(0); cout.precision(output_precision); cout << fixed;
  ss.precision(output_precision); ss << fixed;
#ifdef LOCAL_TEST 
  debug = true;
#endif
  cin >> s;
  ll n;
  if (s.size() <= 10)
  {
    ss << s;
    ss >> n;
  }
开发者ID:hidenori-shinohara,项目名称:codeforces,代码行数:14,代码来源:B.cpp

示例15: main

int main()
{
    ios_base::sync_with_stdio(0); cout.precision(output_precision); cout << fixed;
    ss.precision(output_precision); ss << fixed;
    int A, B, C, original;
    cin >> A >> B;
    C = A+B;
    original = C;
    stack<int> stk;
    while (A)
    {
        stk.push(A%10);
        A/=10;
    }
    while (!stk.empty())
    {
        if (stk.top()!=0) A = 10*A+stk.top();
        stk.pop();
    }

    while (B)
    {
        stk.push(B%10);
        B/=10;
    }
    while (!stk.empty())
    {
        if (stk.top()!=0) B = 10*B+stk.top();
        stk.pop();
    }

    while (C)
    {
        stk.push(C%10);
        C/=10;
    }
    while (!stk.empty())
    {
        if (stk.top()!=0) C = 10*C+stk.top();
        stk.pop();
    }

//    db(A); db(B); db(C);
    if (A+B==C) cout <<"YES" << endl;
    else cout << "NO" << endl;


}
开发者ID:hidenori-shinohara,项目名称:codeforces,代码行数:48,代码来源:A.cpp


注:本文中的stringstream::precision方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。