小编PSt*_*kes的帖子

使用动态分配的内存(指针)

当我正在尝试学习C++时,我正在玩指针和动态内存,并且在编译时我不断收到此错误.

error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::istream' (or there is no acceptable conversion)
Run Code Online (Sandbox Code Playgroud)

我的代码如下:

int * ageP;    
ageP = new (nothrow) int;

if (ageP == 0)
{
    cout << "Error: memory could not be allocated";
}
else
{
    cout<<"What is your age?"<<endl;
    cin>> ageP;                       <--this is the error line
    youDoneIt(ageP);                                            
    delete ageP;
}
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?在此先感谢您的帮助.

c++ io pointers dynamic-memory-allocation visual-c++

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

Jquery $(document).ready()sublime代码段不起作用

我创建了一个sublime片段,它吐出了jquery文档就绪函数.当我开始在javascript文件中键入tab触发器时,它会出现在弹出窗口中,但是当我按Enter或tab时,不会显示任何代码.我尝试多次重启Sublime,但没有成功.

这是我的代码段.

<snippet>
    <content><![CDATA[
$( document ).ready(function() {
    $1
});
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>jdocr</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.js</scope>
</snippet>
Run Code Online (Sandbox Code Playgroud)

关于我做错了什么的任何想法?

jquery sublimetext2

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