CS50错误:称为对象类型' int'不是C中的函数或功能点

发布于 2025-01-23 05:47:54 字数 669 浏览 2 评论 0原文

我是编程的新手,目前我正在哈佛EDX参加CS50课程。我正在尝试解决“信用”问题,但是无论我让自己陷入这个错误:称为对象类型'int'不是函数或点。

我已经尝试阅读书籍片段,该网站上的答案,没有什么有意义的原因,对我来说(我承认是新手),我的int被宣布为功能!有人可以帮我看看这个问题的灯光吗?我将在下面的下面复制并粘贴我的代码:

int lenght_card = 0;
long visa_start = card;
long amex_start = card;
long master_start = card;

while (card > 0)
{
    card = card/10;
    lenght_card++;

}

//将卡标识为Visa

{

visa_start = card/10000000000000;

}

if ((visa_start == 4)(lenght_card == 16 || lenght_card == 13));

{
    printf("%s\n," "VISA");
    return 0;

ps:该错误在第86行中显示了错误:( lenght_card == 16 | |。

预先感谢!

I'm a newbie at programming and currently I'm taking the CS50 course at Harvard edX. I'm trying to solve the "credit" problem but no matter what I keep myself stuck in this error: called object type 'int' is not a function or point.

I've already tried to read book fragments, answers on this website and nothing makes sense cause, to me (a newbie, I admit), my int is declared a function!! Can someone help me to see the light on this problem? I'll copy and paste my code here below:

int lenght_card = 0;
long visa_start = card;
long amex_start = card;
long master_start = card;

while (card > 0)
{
    card = card/10;
    lenght_card++;

}

// Identifying the card as Visa

{

visa_start = card/10000000000000;

}

if ((visa_start == 4)(lenght_card == 16 || lenght_card == 13));

{
    printf("%s\n," "VISA");
    return 0;

PS: the error shows up in the line 86 specifically: (lenght_card == 16 || lenght_card == 13));

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少钕鈤記 2025-01-30 05:47:54

有错别字。

例如,在此语句中,

if ((visa_start == 4)(lenght_card == 16 || lenght_card == 13));

您需要在语句结束时删除分号,并且似乎错过了逻辑和操作员,

if ((visa_start == 4) && (lenght_card == 16 || lenght_card == 13))

另一个错字是在此呼叫中,

printf("%s\n," "VISA");

应在格式之外

printf("%s\n", "VISA");

逗号

puts( "VISA" );

There are typos.

For example in this if statement

if ((visa_start == 4)(lenght_card == 16 || lenght_card == 13));

you need to remove the semicolon at the end of the statement and seems you missed the logical AND operator

if ((visa_start == 4) && (lenght_card == 16 || lenght_card == 13))

Another typo is in this call

printf("%s\n," "VISA");

The comma shall be outside the format string

printf("%s\n", "VISA");

You could just write

puts( "VISA" );
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文