Stack Overflow简单介绍

第一次碰到Stack Overflow是在我搜索某个java运行出错问题时,当时进入以后发现全部是英文,一下傻眼,感觉不适应,对一些专业术语的英文词汇感到非常陌生。不过多接触几次,并尝试去理解英文,发现并不是那么难。

Stack Overflow是一个与程序相关的IT技术问答网站。用户可以在网站免费提交问题,浏览问题,索引相关内容,在创建主页的时候使用简单的HTML。在问题页面,不会弹出任何广告,销售信息,JavaScript窗口等。

Stack Overflow 由 Jeff Atwood 和 Joel Spolsky 这两个非常著名的 Blogger 在 2008 年创建,7月小范围的进行 Beta 测试,直到 9 月份才开始公开的 Beta 测试。Stack Overflow 面向编程人员群体。到2010年年末,Stack Overflow 单个站点在 Alexa 的Rank 是 160 ,月度独立访客超过 1600 万,每月Page View 超过 7200 万 (refer)。Stack Exchange Network 在 2010 年 5 月接受了来自 Union Square Ventures 的 600 万美元的投资,在 2010 年扩大并完善了整个团队,从三个全职工程师发展到了 20 多人的队伍,搬进了 7500 平方英尺的豪华装修的办公室(当然每个人都坐着1000美元一把的椅子)。


从知乎上找到一些使用Stack Overflow的建议:

转载自:https://www.zhihu.com/question/20824615/answer/69560657

提问前一定要搜索,先在 Google 搜索,然后在 StackOverFlow 上搜索,当实在找不到答案后再提问。
对于那些靠搜索就能得到答案的问题,StackOverFlow 上的广大群众是毫不留情的,反对票数量蹭蹭得往上加啊。

学习一些典型的提问/回答习惯

提问:
    1,In my limited experience with .. 谦虚表达自己在某方面的经验

2, I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this. 找了很久未果,求助攻

3,after searching around for a decent XX solution and found that everything out there was difficult to use. 找了N种方法都发现太TM难了。

4,I' ve looked around and apparently I've got the choice between these libraries/ solutions: 说明自己是努力搜索过的,然后目前有了哪几种方案

5,which seems it's a promising solution. 看起来是一个好解决方案

6,Ive tried multiple variations of this, but none of them seem to work. Any ideas? 试了很多种方法都无效,求助

7,Wanted to know if it's good practice to do that and what would be the best way to do that? 我的做法是否正确,是否有更好的法子?

8,Thanks in advance. 先行谢过

回答问题:
    1,If I understand you correctly, you want to xxx 如果我没理解错,你想。。

2,Can you provided more details about your use case ? Can you provide more xml and code setting the url ? 提供更详细

当别人回答你的问题后,你对回答的评论:
       1,thank you for your answer sincerely 感谢回答

 

官方网址为:http://www.stackoverflow.com/

  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
好的,这个问题非常适合用程序解决。以下是用stack实现简单计算器的c代码示例: ```c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #define STACKLEN 1000 /* 栈的最大容量 */ typedef struct { int top; /* 栈顶指针 */ double data[STACKLEN]; /* 元素数组 */ } Stack; void push(Stack *pstack, double value) { if (pstack->top == STACKLEN - 1) { printf("Error: stack overflow!\n"); exit(EXIT_FAILURE); } else { pstack->data[++pstack->top] = value; } } double pop(Stack *pstack) { if (pstack->top == -1) { printf("Error: stack underflow!\n"); exit(EXIT_FAILURE); } else { return pstack->data[pstack->top--]; } } bool is_digit(char c) { return (c >= '0' && c <= '9'); } int precedence(char op) { if (op == '+' || op == '-') return 1; else if (op == '*' || op == '/') return 2; else return 0; } double calculate(double left, char op, double right) { switch (op) { case '+': return left + right; case '-': return left - right; case '*': return left * right; case '/': return left / right; default: printf("Error: invalid operator!\n"); exit(EXIT_FAILURE); } } double eval(char *expr) { Stack operandStack; operandStack.top = -1; Stack operatorStack; operatorStack.top = -1; int len = strlen(expr); int i = 0; while (i < len) { char c = expr[i]; if (is_digit(c)) { double value = 0.0; while (i < len && is_digit(expr[i])) { value = value * 10.0 + (double)(expr[i] - '0'); i++; } push(&operandStack, value); } else { while (operatorStack.top != -1 && precedence(operatorStack.data[operatorStack.top]) >= precedence(c)) { char op = operatorStack.data[operatorStack.top--]; double right = pop(&operandStack); double left = pop(&operandStack); push(&operandStack, calculate(left, op, right)); } push(&operatorStack, c); i++; } } while (operatorStack.top != -1) { char op = operatorStack.data[operatorStack.top--]; double right = pop(&operandStack); double left = pop(&operandStack); push(&operandStack, calculate(left, op, right)); } return pop(&operandStack); } int main() { char s[1000]; printf("Please enter an expression: "); scanf("%s", s); double result = eval(s); printf("Result: %f\n", result); return 0; } ``` 这段代码定义了两个栈:一个操作数栈(operandStack)和一个操作符栈(operatorStack),通过不断入栈和出栈的操作,实现对表达式进行求值。其中,is_digit函数用于判断一个字符是否是数字;precedence函数用于比较两个运算符的优先级;calculate函数用于计算两个操作数和一个操作符的运算结果;eval函数是主函数,用于将输入的表达式转化为数字计算结果。 希望这个回答能够帮助您!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值