由买买提看人间百态

topics

全部话题 - 话题: fout
1 (共1页)
c**********e
发帖数: 2007
1
来自主题: Programming版 - Why no output file generate? What is wrong?
Why output.txt not generated? What is wrong?
#include
#include
using namespace std;
void print(int num, fstream& fout)
{ fout << num << endl; }
int main() {
fstream fout;
fout.open("output.txt");
print(2, fout);
print(3, fout);
}
a*****e
发帖数: 1717
2
Here's python one I used before,
drawbacks:
1. data pacing violation, limit on size of each quote, interval etc.
2. futures symbols are less standardized
3. IB data sucks, but ok for median to long term backtest
4. the ibpy is out-dated, you have to update yourself to get new
features.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from ib.ext.Contract import Contract
from ib.opt import ibConnection, message
from time import sleep
from datetime import date
import pyodbc, os, sys
# print all mess... 阅读全帖
D******4
发帖数: 47
3
来自主题: Programming版 - 请问一个入门级 dynamic memory 的问题
今天看到dynamic memory,测试如下程序:
#include
#include
#include
using namespace std;
ifstream fin("test.in");
ofstream fout("test.out");
int main (){
int i = 0;
int n = 0;
int* p;

if(fin.is_open()){
fin>>n;
fout<<"n is: "< p = new (nothrow) int[n];
if (p == 0)
fout << "Error: memory could not be allocated"< else{
for (i=0; i> p[i];
fin.close();
fout << "You have ent
t****t
发帖数: 6806
4
来自主题: Programming版 - Why no output file generate? What is wrong?
since you used fstream, the open mode is 0 by default. you have to
explicitly say
fout.open("...", ios_base::out);
or alternatively, use
ofstream fout;
fout.open("...");
EDIT: the default open mode is in|out by default. seems it's not stated
on standard, but i guess most implementation will do that. however, if
you specify ios_base::in, and file do not exist, the open will fail anyway.
l********a
发帖数: 1154
5
直接上次的当函数就行了,
#! /usr/bin/env python
def getAcronym(s):
return ''.join([x for x in s.title() if x.isupper()])
# main entry
fnin = raw_input('Please specify the input filename:\n')
fnout = raw_input('Please specify the output filename:\n')
sout = ''
if len(fnin.strip())>0 and len(fnout.strip())>0:
fin = open(fnin,'r')
for sline in fin.readlines():
sout += getAcronym(sline)+'\n'
fin.close()
fout = open(fnout,'w')
fout.write(sout)
fout.close()
print 'Done'
els... 阅读全帖
f*****c
发帖数: 3257
6
来自主题: GeoSpace版 - ArcGIS问题求助
我有美国road shape file和全美500个城市的longtitude and latitude。
现在需要计算每对城市之间的road distance.
我从网上找的办法是用python写code,可是总是出错。
各位大神帮忙看一下 。由于没有时间变量,所以里面关于时间的我都给省去了
import arcpy, os, sys
arcpy.env.overwriteOutput = True
try:
# costDic1 = {}
f = open(r"C:UsersUserDocumentsArcGISindia.txt", 'r+')
layer1 = "Route" #an open in-memory layer

for line in f:
twoPs = line.split(",")

# if the line contains number
if twoPs[0].isdigit():
OPoint = arcpy.Point()
... 阅读全帖
d***a
发帖数: 316
7
来自主题: CS版 - 改变 c string 的一个问题
想法是用户输入一个文件名,例如 someresults.txt
然后用ifstream读入,处理后,用ofstream保存为 someresults_data_extracted.txt
用户输入的文件后缀要去掉。
以下是产生问题的部分code,其它省略。
整个程序g++编译通过的。

#include
#include
#include
#include

cout << "Enter the file to work on: ";
string originName;
getline(cin, originName);


// code for ifstream to read a file
…..


char * tempOut = new char [originName.size()+16];
strncpy(tempOut, originName.c_str(), originName.size()-4);
ofstream fout;
fout.open( strcat(tempO... 阅读全帖
g****g
发帖数: 1828
8
比如把一个10列文件最后3列复制一遍。
#!/bin/sh
mkdir after
for fin in `ls *.txt`
do
fout=after/$fin
cat $fin | grep -v '#' |awk '{print $1 "\t\t" $2 "\t\t" $3 "\t\t" $4 "\t\
t" $5 "\t\t" $3 "\t\t" $4 "\t\t" $5 "\t\t" $6 "\t\t" $7 "\t\t" $3 "\t\t" $8
"\t\t" $9 "\t\t
" $10 "\t\t" $8 "\t\t" $9 "\t\t" $10 }' >> $fout
done
b***i
发帖数: 3043
9
我想把用户输入的所有信息和程序输出的所有信息都输出到一个文件中去,
这样,形成一个log。
有没有简单方法,不用每次用cout<<.......
都再写一个fout<<.....
? 多谢
比如,可不可以fout< 或者,用宏?自定义一个stream?
S*A
发帖数: 7142
10
来自主题: Programming版 - 脚本问题求教
#!/usr/bin/python
fout = open('output.txt', 'w')
for l in open('input.txt'):
column = l.split()
fout.write('%s %s\n%s %s\n'%tuple(column))
d******e
发帖数: 40
11
来自主题: Georgia版 - 有人打网球吗?
我们有很多人在北部 Roswell 地区打网球,original we are all from atlantachinese.org fungroup, 经过几年在一起打球,现在全年参加比较competitive的男双,女双,混双
队伍打 ALTA 和 USTA league 3.5, 欢迎想打网球,学网球的人到East Roswell Park去,
我们有周末都有比赛和练习,平时也有。
地址:
900 fouts road
Roswell, 30076
站内联系
a***n
发帖数: 287
12
来自主题: Bridge版 - Another Subtle Hand
Other than the regular friendly break in spades and clubs, you can cater
the case where long trump opponent holds fout clubs too by only drawing
two round of trumps and then run two rounds of clubs to see if you need
a club ruff on board.
Did I overlook something here?
t*n
发帖数: 14458
13
校花99年41个TD,13个INT,complete% 65.1, yard/attempt 8.7, Passer rating 109.2
Bulger 6场比赛14 TD, 6INT, complete%64.5, yard/attempt 8.5, rating 101.5
校花99年每3.15个TD有一个INT,Bulger今年每2.33个TD有一个INT。
你要再看穿球的质量就知道Bulger跟校花不在同一水平上。以前Dan Fouts在电视里
解说过为什么Rams的WR的run after catch好,原因之一就是校花总是把球放到WR眼前
最舒服的地方,这样不但容易接,而且不必调整,眼睛也不用转来转去的看。看看99
年校花那些70,80吗的长传,总能恰到好处地lead receiver,而今年(包括校花在内)
的deep throw就我所看到的都是under throw,全靠Bruce GG和Holt DD的接球功夫。
校花是NFL历史上最好的pocket passer之一(如果不是最好的),Bulger还不在同一
水平上。
g******a
发帖数: 667
14
来自主题: Football版 - HOF QB and college
SEC and Big-10 got the most (5 each). Enough for the Pac-10 have the most star
quarterback talk.
SEC
Alabama: Joe Namath, Bart Starr
Kentucky: George Blanda
Georgia: Fran Tarkenton
LSU: Y. A. Tittle
Big 10
Purdue: Len Dawson, Bob Griese
Northwestern: Otto Graham, John Driscoll
Wisconsin: Arnie Herber
Pac-10
Stanford: John Elway
Oregon: Dan Fouts, Norm Van Brocklin
UCLA: Bob Waterfield
Others:
Lousiana Tech: Terry Bradshaw
Duke: Sonny Jurgensen, Clarence Parker
Miami: Jim Kelly
Texas: Bobby Layne
a***n
发帖数: 5520
15
来自主题: Football版 - 猪不理今天就憋着劲破记录啊
dan fouts
b**j
发帖数: 20742
16
来自主题: Football版 - 在NFL打QB要成功,取名字很重要
叫Tim, Dan的都没拿过superbowl
Tim Couch
Tim Tebow
Dan Marino
Dan Fouts
m*****y
发帖数: 2424
17
还真是忘了这杆老枪了,属于那几个Great QB's who never won the big one, i.e.
Marino, Kelly, Fouts, etc.
B*****e
发帖数: 9375
18
来自主题: Football版 - NFL QB分群+排序

没mvp是硬伤么?
我们不能看着大曼宁手里一堆的MVP,
将来肯定也是第一票入选,就把两者强烈联系起来。
这些二战后入堂的两毛五, 很多MVP? I did not tabulate.
Modern Era: Quarterbacks (23)
Troy Aikman 1989-2000
George Blanda (Also PK) 1949-1958, 1960-1975
Terry Bradshaw 1970-1983
Len Dawson 1957-1975
John Elway 1983-1998
Dan Fouts 1973-1987
Otto Graham 1946-1955
Bob Griese 1967-1980
Sonny Jurgensen 1957-1974
Jim Kelly 1986-1996
Bobby Layne 1948-1962
Dan Marino 1983-1999
Joe Montana 1979-1994
Warren Moon 1984-2000
Joe Namath 1965-1977
Bart Starr 1956-1971
Rog... 阅读全帖
w********g
发帖数: 805
19
来自主题: Football版 - NFL第一人之争(zz)
第49届超级碗之前,Goat之争主要发生在Joe Montana和Jerry Rice之间;而现在,Tom
Brady可以进入讨论范围了···
今年之前蒙塔纳被广泛地认为是NFL历史上最伟大的四分卫。莱斯10年11月4号被NFL
Network出品的《The Top 100: NFL's Greatest Players》评为历史第一,他也同时获
得了NFL Network调查的球迷评出的历史第一。然而当时布雷迪传球只有3万多码,还未
第五次打进超级碗、未拿到生涯首个5000码赛季、未拿到第二个MVP和第二个年度进攻
球员,职业碗数也比现在少5次。1999年ESPN评选的“20世纪最伟大的运动员”,蒙塔
纳是排在莱斯前面的。2000赛季以来莱斯的主要成就是2个千码赛季打进一次超级碗,
如果他可以凭这样的成就超越蒙塔纳,布雷迪一样可以凭借11-14连续四个4000码赛季
打进两次超级碗(史上唯一一位六进超级碗的QB)拿到一次冠军一次超级碗MVP的成就
超越蒙塔纳和莱斯。
维基上对莱斯的描述是“among the greatest NFL players overall”——历史最佳之
一... 阅读全帖
s*****h
发帖数: 44903
20
来自主题: Football版 - [合集] NFL QB分群+排序
☆─────────────────────────────────────☆
siriusliu (天狼) 于 (Wed Oct 9 01:51:59 2013, 美东) 提到:
跟lp普及,聊起QB物以类聚,人以群分。跟大家分享,同求指教。
第一群,也是第一档,四大HOFer,菜鼻猪龙。ring也有,常规赛mvp也有(猪是例外,
但是N次前三,多次第二,而且是差不多可以并列第一的第二,算成mvp也没有问题)。
总之,无需再证明什么,HOF没跑。剩下的就是如何reinforce legacy。
第二群,小白菜,大本,伊力特。有运气也有心脏。有ring。但是从未常规赛打出mvp
水准。问题,这三人有无可能混进hof?多半没戏,但是有无可能?
第三群,麻软,小河,肉末,微克,杰小卡,四大夫,纱布。常规赛有过出色数据跟战
绩,也混了大合同,也算是franchise qb。但是从未季后赛证明自己。也老大不小了,
基本不可能撞上狗屎运挤入第二群。
第四群,四大新人,运气,rw,ck,rg3。勉强可以加进牛顿。还年轻,一起都早。
luck有望进第一群,rw跟ck有望进第二群。rg3跟... 阅读全帖
t***a
发帖数: 7982
21
来自主题: Football版 - 4th Quarter Comeback Leader
搜了一下,找到了,>=3的
1 Tom Brady 8
2 Joe Montana+ 5
3 Terry Bradshaw+ 4
John Elway+ 4
Eli Manning 4
Russell Wilson 4
7 Ken Stabler+ 3
Ben Roethlisberger 3
Dan Marino+ 3
Dan Fouts+ 3
g******a
发帖数: 667
22
来自主题: NCAA版 - [转载] HOF QB and college
【 以下文字转载自 Football 讨论区,原文如下 】
发信人: gardenia (十六字令), 信区: Football
标 题: HOF QB and college
发信站: Unknown Space - 未名空间 (Tue Oct 5 13:57:57 2004) WWW-POST
SEC and Big-10 got the most (5 each). Enough for the Pac-10 have the most star
quarterback talk.
SEC
Alabama: Joe Namath, Bart Starr
Kentucky: George Blanda
Georgia: Fran Tarkenton
LSU: Y. A. Tittle
Big 10
Purdue: Len Dawson, Bob Griese
Northwestern: Otto Graham, John Driscoll
Wisconsin: Arnie Herber
Pac-10
Stanford: John Elway
Oregon: Dan Fouts,
s****z
发帖数: 328
23
来自主题: pets版 - 黑猩猩Lucy的故事
故事的synopsis
the haunting epic of Lucy the chimpanzee. When Lucy was only two days old,
she was adopted by psychologist Dr. Maurice K. Temerlin and his wife Jane.
The Temerlins wondered, if given the right environment, how human could Lucy
become? We hear from Lucy's language tutor, Dr. Roger Fouts, Lucy's
caretaker and eventual friend, Dr. Sue Savage-Rumbaugh, and Mr. Temerlin
himself... or his words anyway, read by radio host David Garland. And writer
Charles Siebert helps us to make sense of L
z**n
发帖数: 22303
24
来自主题: Wisdom版 - 舍利巡回展。 (转载)
【 以下文字转载自 DHARMA_WITHOUT_BORDER 俱乐部 】
发信人: zoun (Konchog Gyamtso), 信区: DHARMA_WITHOUT_BORDER
标 题: 舍利巡回展。
发信站: BBS 未名空间站 (Tue Nov 19 10:41:27 2013, 美东)
日程:
http://www.maitreyarelictour.com/calendar/
图片:
http://www.maitreyarelictour.com/relic-collection/
Buddha Relic Americas Tour 2013 & 2014
29, 30 November & 1 December 2013
Fort Worth, Texas, USA
Friday: 6pm to 8pm Opening Ceremony
Saturday: 10am to 7pm
Sunday: 10am to 5pm
Unity Fort Worth
5051 Trail Lake Drive
Fort Worth
Texas 76133
USA
Contac... 阅读全帖
c****p
发帖数: 6474
25
来自主题: CS版 - 改变 c string 的一个问题
你这么做就麻烦了。。
拿到OriginalName之后:
string tempOut = OriginalName + ".......txt";
fout = fopen(tempOut.c_str(),"wt");
...
而且输入文件名其实可以这样。。。
int main(int argc, char* argv[])
{

string OriginName(argv[1]);
...
}
这么做的好处是可以直接在命令行就指令输入文件,
再写个脚本做批处理之类的很方便,
省得每运行一次程序你都得手动输入文件名。
写得再复杂点都可以弄成支持通配符的。【 在 dunfa (蹲着发财) 的大作中提到: 】
txt
S*********g
发帖数: 5298
26
来自主题: Programming版 - Why no output file generate? What is wrong?
fout.close();
m*********8
发帖数: 6
27
现在需要设计一个1175MHz的oscillator,因为查了一下,能买到的最高的oscillator只
有1G,问了一下老师,给我画了一个图,要VCO,TLL,crystal oscillator,但是看不
懂啊,不知道怎么搞,说编程达到fout=N*fin(crystal).哪位高人能帮忙,资料。感谢
d********g
发帖数: 11948
28
Fout ~ 16M - 64M with 4/6/8x multi ; Fin ~ 2M - 16M
d********g
发帖数: 11948
29
Fout ~ 16M - 64M with 4/6/8x multi ; Fin ~ 2M - 16M
1 (共1页)