标题:逻辑错误吗,为什么输出都是2686728
取消只看楼主
河北沧州黄骅
Rank: 1
等 级:新手上路
帖 子:19
专家分:3
注 册:2015-10-18
结帖率:16.67%
已结贴  问题点数:10 回复次数:1 
逻辑错误吗,为什么输出都是2686728
#include <stdio.h>
int main(void)
{
    int profit,salary;
    printf("input a salary:");
    scanf("%d",&profit);
    if(profit<=1000)
    {salary=500;}
     else  if(profit>1000&&profit<=2000)
       {

       salary=500+profit*0.10;}
        else if(profit>2000&&profit<=5000)
        {salary=500+profit*0.15;}
        else if(profit>5000&&profit<=10000)
       {
           salary=500+profit*0.20;}
    else if(profit>10000)
       {

       salary=500+profit*0.25;}
    printf("salary=:%d",&salary);

}
搜索更多相关主题的帖子: include profit include profit 
2015-11-04 18:11
河北沧州黄骅
Rank: 1
等 级:新手上路
帖 子:19
专家分:3
注 册:2015-10-18
得分:0 
回复 2楼 wmf2014
定义后也不行,逻辑错误我觉得是
2015-11-04 23:08



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-458879-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.681788 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved