小编Con*_*erd的帖子

如何确保控制台在运行代码时不会立即关闭?

我正在尝试学习 C 编程,但是当我运行我的代码时,cmd,窗口立即关闭,没有给我更改以查看程序是否打印了我想要的结果。

我在 VS-Code 上编写 C,使用多个扩展。是否有设置/扩展/代码片段,或者我可以做的任何事情,所以它不会立即关闭?

谢谢!

c c++ console visual-studio visual-studio-code

5
推荐指数
1
解决办法
2109
查看次数

Project Euler Problem 8,C 语言(适用于 4 位数字,不适用于 13 位数字)

当我计算 4 个数字的最高乘法时,我的代码会吐出正确答案;但是,当我尝试计算 13 时却没有。(我得到了答案,但不正确)。

顺便说一句,我尝试查看解决方案,但没有找到可以帮助我找出确切错误的内容。我还确保使用 unsigned long long ints 以防数字很高,所以我认为这不是问题。这是我的代码:

#include <stdio.h>
#include <math.h>

#define SIZE 13

int main (void)
{
    //variables declaration (ull just in case it's too big).
    unsigned long long sum = 0;
    unsigned long long temp = 1;
    int count = 0;

    //here I paste the number from the question to insert it in the array.
    int arr[1000];
    printf("enter the number: \n");
    for (int i=0; i<1000; i++)
    {
        scanf("%1d", &arr[i]);
    }

    //this loop makes sure …
Run Code Online (Sandbox Code Playgroud)

c

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

标签 统计

c ×2

c++ ×1

console ×1

visual-studio ×1

visual-studio-code ×1