小编Dea*_*ng0的帖子

修复这个if,else语句

问题似乎正在发生

第18行:警告:指针和整数之间的比较
第22行:错误:'else'之前的预期表达式

我究竟做错了什么?有没有更好的方法呢?

#include <stdio.h>

int main(void)
{
    char pname[25];
    char Y[1];
    char N[1];
    char choice[1];

    printf("when responding to Yes or No questions use Y/N.\n");
    printf("Hello,traveler Welcome to the Castle of Atal...."
            "What is your name?\n");
    scanf("%s", &pname);

    printf("Greeting's %s What bring's you to the kingdom of Tharnos?\n",
            pname);
    printf("I see how intresting do you wish to enter %s ?\n", pname);
    scanf("%c", &choice);

    if (choice == 'Y');
        printf("Enter %s...\n", pname);
    else (choice == 'N');
        printf("Farewell lost soul!\n");

    return 0; …
Run Code Online (Sandbox Code Playgroud)

c char

3
推荐指数
2
解决办法
210
查看次数

(Python)为什么它返回9.0而不是9?

尝试在python中为"学习Python书"中的项目创建一个简单的计数器

简介:编写一个为用户计算的程序.让用户输入起始编号,结束编号和计数的数量.

问题:好的,所以基本上试图确保如果用户输入
(从2开始并在2中计数到17),程序会将其标记为不可能.

print ("Welcome to the program for those who are to lazy to count")
print ("You must be really really lazy too use this")

input ("\n Press any key to continue")

Num1 = int(input ("Please Enter Starting Number: \n"))
Num2 = int(input ("Please Enter Ending Number: \n"))
count = int(input ("Count up in: \n"))

differ = (Num2 - Num1)

test =(differ/count)

if isinstance(test,int):
 while (Num1 < Num2):
  Num1 += count
  print (Num1)   
  isinstance( test, int )
else: …
Run Code Online (Sandbox Code Playgroud)

python floating-point integer python-3.x

0
推荐指数
1
解决办法
193
查看次数

标签 统计

c ×1

char ×1

floating-point ×1

integer ×1

python ×1

python-3.x ×1