H*u
2 楼
我现在的h1b到6月5号到期,新的工作要8月才开始。估计新的h1b也得等8月在办,麻烦
问问中间那2个月的gap怎么办呢?如有知道的帮忙回答一下,太谢谢了。
问问中间那2个月的gap怎么办呢?如有知道的帮忙回答一下,太谢谢了。
m*c
3 楼
不知不觉,家居版居然超10万贴了
x*2
4 楼
这个批的好快啊。 --LOL
S*0
8 楼
re
c*9
9 楼
恭喜大板斧:D
s*u
10 楼
太搞了,我考
s*c
12 楼
没事,黑着就好,2个月没关系,不会影响绿卡,就是新h1b可能需要回国签回来。
b*y
14 楼
顶,必须滴,等着给我们大家发包子,呵呵
b*2
15 楼
lol
f*c
19 楼
恭喜恭喜,排包子
f*b
22 楼
hao
y*2
27 楼
gongxi
j*g
28 楼
见过很多次这个题目了,一直没有招,下面写了一个又臭又长的, 方法很笨, 求建议
, 欢迎批评和指正
这样的代码面试可以通过吗?
////////////////////////////////////////////////////////////////
#include
#include
using namespace std;
//假设16位的整型
// -32768 , +32767
const char MAX_INT[] = "32767";
const char MIN_INT[] = "32768";
const int MAX_STRLEN = 5;
bool my_atoi(const char *str, int &res)
{
if(str == NULL)
{
cout << "Invalid pointer" << endl;
return false;
}
int index = 0;
if(str[index] == '-' || str[index] == '+')
{
index++;
}
if(str[index] == '\0')
{
cout << "Empty string" << endl;
return false;
}
if(strlen(str + index) > MAX_STRLEN)
{
if(str[0] == '-')
{
cout << "Underflow1" << endl;
}
else
{
cout << "Overflow1" << endl;
}
return false;
}
if(strlen(str + index) == MAX_STRLEN)
{
if(str[0] == '-' && strcmp(str + index, MIN_INT) > 0)
{
cout << "Underflow2" << endl;
return false;
}
else if(str[0] != '-' && strcmp(str + index, MAX_INT) > 0)
{
cout << "Overflow2" << endl;
return false;
}
}
/////////////////////////////////////////////////////////////////
res = 0;
bool is_neg = (str[0] == '-') ? true : false;
while(str[index] != '\0')
{
res = res * 10 + str[index++] - '0';
}
if(is_neg)
res = -res;
return true;
}
int main(int argc, char **argv)
{
while(true)
{
char *str = new char[120];
cin >> str;
int res;
if(my_atoi(str, res))
{
cout << "int(" << str << ") = " << res << endl;
}
delete []str;
}
return 0;
}
, 欢迎批评和指正
这样的代码面试可以通过吗?
////////////////////////////////////////////////////////////////
#include
#include
using namespace std;
//假设16位的整型
// -32768 , +32767
const char MAX_INT[] = "32767";
const char MIN_INT[] = "32768";
const int MAX_STRLEN = 5;
bool my_atoi(const char *str, int &res)
{
if(str == NULL)
{
cout << "Invalid pointer" << endl;
return false;
}
int index = 0;
if(str[index] == '-' || str[index] == '+')
{
index++;
}
if(str[index] == '\0')
{
cout << "Empty string" << endl;
return false;
}
if(strlen(str + index) > MAX_STRLEN)
{
if(str[0] == '-')
{
cout << "Underflow1" << endl;
}
else
{
cout << "Overflow1" << endl;
}
return false;
}
if(strlen(str + index) == MAX_STRLEN)
{
if(str[0] == '-' && strcmp(str + index, MIN_INT) > 0)
{
cout << "Underflow2" << endl;
return false;
}
else if(str[0] != '-' && strcmp(str + index, MAX_INT) > 0)
{
cout << "Overflow2" << endl;
return false;
}
}
/////////////////////////////////////////////////////////////////
res = 0;
bool is_neg = (str[0] == '-') ? true : false;
while(str[index] != '\0')
{
res = res * 10 + str[index++] - '0';
}
if(is_neg)
res = -res;
return true;
}
int main(int argc, char **argv)
{
while(true)
{
char *str = new char[120];
cin >> str;
int res;
if(my_atoi(str, res))
{
cout << "int(" << str << ") = " << res << endl;
}
delete []str;
}
return 0;
}
s*l
30 楼
排包子
c*p
32 楼
对于加法而言,
overflow只在同号的两个数相加的时候发生。
c = a + b;
if(((b>0) && (ca)))
// overflow
【在 z****u 的大作中提到】
: 那在运行时该如何判断 overflow?
: 每次运算前都要检查,而且针对不同的运算,检查方式也不同吧?这样岂不是开销很大
: 还是在设计的时候就避免 overflow?将可能产生overflow的输入判定为非法输入?这
: 个貌似也不可行啊
overflow只在同号的两个数相加的时候发生。
c = a + b;
if(((b>0) && (ca)))
// overflow
【在 z****u 的大作中提到】
: 那在运行时该如何判断 overflow?
: 每次运算前都要检查,而且针对不同的运算,检查方式也不同吧?这样岂不是开销很大
: 还是在设计的时候就避免 overflow?将可能产生overflow的输入判定为非法输入?这
: 个貌似也不可行啊
c*o
34 楼
神马是孢子?
r*t
36 楼
这么写是 undefined
【在 c****p 的大作中提到】
: 对于加法而言,
: overflow只在同号的两个数相加的时候发生。
: c = a + b;
: if(((b>0) && (ca)))
: // overflow
【在 c****p 的大作中提到】
: 对于加法而言,
: overflow只在同号的两个数相加的时候发生。
: c = a + b;
: if(((b>0) && (ca)))
: // overflow
r*n
38 楼
re
y*i
44 楼
恭喜恭喜
EA
45 楼
re
o*r
46 楼
恭喜!
b*y
47 楼
跟贴吃包子
G*a
48 楼
谢谢大家,老大妈要面对新兴事物啦,喔喔。
r*o
49 楼
排
N*r
50 楼
恭喜
h*8
51 楼
排
相关阅读
坐飞机这种事情,在机场或空中嗓门越大的越没背景 (转载)老外杀进煎饼业 时报广场摊煎饼 (转载)Re: AMC 8 Problem 25 (转载)Re: 《平凡的世界》观后感 (转载)坐飞机装逼是全程的,从候机开始。 (转载)大学生网贷买iPhone6无力偿还 拆东墙补西墙欠70余万 (转载)周末 shower thoughtsRe: FireTV怎么播放NAS上的媒体 (转载)方静了解的张召忠将军「秒買秒退大滅頂」鄉民退了2萬多元的林鳳營!广东曝多起冒充纪委诈骗案:公然把人带去双规 (转载)凭啥呀?!Marissa Meyer一年几十米美国枪支销售量空前,白宫表示不能理解 (转载)投诉wh wh下台 (转载)yugong你贴的所有图都ps得很厉害,像卡通片火鸡女律师行为艺术“码”是啥单位NYT也发现中国人最喜欢床铺美国海归女博士被骗11万 不相信警察一周内破案退款 (转载)