C ++帮助我理解为什么没有输出
c++ help me to understand why there is no output
这个程序很简单:1(取一个输入字符串。2(将其转换为长.3(打印转换结果。
期望输出,但未找到。
#include <stdio.h>
#include <string>
using namespace std;
int main()
{
string ch;
scanf("%s",ch);
long l=stol(ch);
printf("%l",l);
return 0;
}
以下是如何使用
C++ I/O完成此操作。在C++程序中使用 C I/O 的理由很少。
#include <iostream>
#include <string>
int main()
{
std::string input;
std::cin >> input; // take an input string
long lval = stol(str); // convert to long
std::cout << lval << 'n' // print the result
}
现在这些东西将在任何C++本书的第一章中介绍。一本好书将大大提高你学习C++的速度和程度。
相关文章:
- 为什么输出精度没有正确舍入?
- 为什么输出窗口上没有显示输出?
- 为什么输出是整数而不是双精度?
- 为什么输出总是空的?
- 为什么输出流首选" "而不是""?
- 为什么输出不同以及此代码中有什么错误
- 为什么输出在睡眠后没有换行符?
- 为什么输出会进入无限循环
- 为什么输出错误崩溃
- 我试着了解方法覆盖是如何工作的,不知道为什么输出 2
- 任何人都可以解释此程序的类型促销以及为什么输出相同
- 为什么输出不是 00706
- C++:为什么输出迭代器不支持比较操作?
- 为什么输出是 2 而不是 7 ?+ 号如何使它与众不同
- 什么是bad_alloc?为什么输出屏幕没有显示所有值
- 为什么输出是无限的?
- 我无法理解为什么输出在这个 for 循环中出现 10
- 为什么输出有时会失败
- C 参考和类对象的非参考返回 - 为什么输出相同
- 为什么输出中缺少字母'D'?