可能重复:
成员函数结束时const的含义是什么?
如果我的类定义如下:
type CLASS::FUNCTION(int, const char*) const
Run Code Online (Sandbox Code Playgroud)
结束括号后的最后一个const是什么意思,以及如何将它应用于函数:
type CLASS::FUNCTION(int var1, const char* var2) {
}
Run Code Online (Sandbox Code Playgroud) 我在C++工作.我给了一个10位数的字符串(字符数组),其中可能有或没有3个破折号(最多13个字符).是否有内置的方式使用流向右对齐它?
我如何才能正确地打印到流中?是否有内置函数/方法来执行此操作,还是需要在字符数组的开头填充3个空格?
我正在处理ostream是具体的,不确定这是否重要.
如果您不熟悉锦标赛支架的含义,请参阅此处:http: //baseballguru.com/bracket1.gif
也就是说,我已经构建了数据集并计算了轮数(ceil(log($ numPlayers,2)))并且我很容易找到每轮中的玩家数量等.
我现在需要做的是将每一轮的比赛数组移动到一个括号中.无论是CSS,还是已提出,我都可以自己玩设计,我只是想知道我应该如何构建这个(考虑锦标赛可以有不同数量的轮次)到视觉上.
谢谢!
我希望计算多边形上每个点的X和Y点,给定边数,以及所有边都相等的事实.我也有整个形状的宽度和高度限制.如果它有帮助,我会用Java做这个(最有可能使用Line2D).
ISBN.cpp:8:错误:"ISBN"尚未声明
ISBN.cpp:8:错误:ISO C++禁止声明'ISBN'没有类型ISBN.cpp:在函数'int ISBN()'中:
ISBN.cpp:9:错误:未在此范围内声明'area'
ISBN.cpp:10:错误:未在此范围内声明'publisher'
ISBN.cpp:11:错误:'title'未在此范围内声明ISBN.cpp:12:错误:'checkdigit'未在此范围内声明ISBN.cpp:13:错误:'isbnStr'未在此声明范围
第8到14行是:
ISBN::ISBN() {
area = NULL;
publisher = NULL;
title = NULL;
checkdigit = NULL;
isbnStr = NULL;
}
Run Code Online (Sandbox Code Playgroud)
它们都在标题中声明:
class ISBNPrefix;
class ISBN
{
private:
int area;
int publisher;
int title;
char checkdigit;
char* isbnStr[10];
public:
ISBN();
...
Run Code Online (Sandbox Code Playgroud)
关于这里可能出现什么问题的任何想法?我猜它简直就是我想念的东西.
在GDB中我得到:
(gdb) backtrace 0 0xb7d91544 in strcpy () from /lib/libc.so.6 1 0x08048982 in ISBN::ISBN(char const*, ISBNPrefix&) () 2 0x08048d4a in main () (gdb)
从这段代码:
ISBN::ISBN(const char* str, ISBNPrefix& list) {
if(isValid(str)) {
isSet = true;
sprintf(*isbnStr,"%s",str);
}
}
Run Code Online (Sandbox Code Playgroud)
究竟是什么导致了这个?
isbnStr是在标题中创建的:
class ISBN
{
...
char* isbnStr[11];
...
Run Code Online (Sandbox Code Playgroud)
关于我在这里做什么导致这个段错误的任何想法?
主要是:
ISBN* isbn = new ISBN("7999999008",*prefix);
Run Code Online (Sandbox Code Playgroud)