小编Aan*_*Aan的帖子

是否存在c ++的非英语语法

我听说有一个非英语的c ++语法,它似乎是c ++风格,但有翻译的术语!
我们能找到像这样的郎!

c++

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

Ofstream不能很好用吗?

在这段代码中,fout是一个ofstream对象,它假设写入一个名为的文件output.txt.因为一个output.txt总是空的原因!我会问我在代码中犯的错误:

#include<iostream>
#include<fstream>
#include<stdio.h>//to pause console screen
using namespace std;

double Volume(double);

int main() {
    ifstream fin; //read object
    ofstream fout;// writing object
    double Radius;
    fin.open("input.txt");
    fout.open("output.txt");
    if(!fin){
        cout<<"There a problem, input.txt can not be reached"<<endl;
    }
    else{
fin>>Radius;
fout<<Volume(Radius);
cout<<"Done! check output.txt file to see the sphare volume"<<endl;
    }

    getchar();//to pause console screen
return 0;
}

double Volume(double r){

double vol;
vol= (4.0/3.0)*3.14*r*r*r;
return vol;
}
Run Code Online (Sandbox Code Playgroud)

c++ fstream file

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

从另一个构造函数调用构造函数?

我创建了三个类:( Shape基类),RectangleSquare.我试图ShapeRectangle's和Square's构造函数调用构造函数,但编译器显示错误.

这是代码:

class Shape{
public:
    double x;
    double y;
    Shape(double xx, double yy) {x=xx; y=yy;}
    virtual void disply_area(){
        cout<<"The area of the shape is: "<<x*y<<endl;
    }
};
class Square:public Shape{
public:
    Square(double xx){ Shape(xx,xx);}
    void disply_area(){
        cout<<"The area of the square is: "<<x*x<<endl;
    }
};
class Rectnagel:public Shape{
    public:
        Rectnagel(double xx, double yy){ Shape(xx,yy);}
    void disply_area(){
        cout<<"The area of the eectnagel is: "<<x*y<<endl;
    }
};
int main() { …
Run Code Online (Sandbox Code Playgroud)

c++ oop constructor

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

getchar()不能正常工作?

我用C++编写了这段代码,我常常使用getchar()控制台,但我没有看到使用该函数的任何影响,这里是代码:

#include<iostream>
#include<stdio.h>//to pause console screen

using namespace std;
//function prototypes
int  getSmallest(int*);
int getOccurrence(int, int*);

int main(){

    int a[7], counter=0, smallest;
    cout<<"Please enter 7 integers"<<endl;
    while(counter!=7){
        cin>>a[counter];
        counter++;
    }
    smallest=getSmallest(a);
    cout<<"The smallest number is "<<smallest<<"; it apears "<<getOccurrence(smallest,a)<<" times"<<endl;
    getchar();//to pause console screen
    return 0;
}

int  getSmallest(int*x){
int count=0, smallest=*x;
//loop till last item in array
while(count!=7){

    if(*x<smallest)
        smallest=*x;
    count++;
    x++;
}
return smallest;
}


int getOccurrence(int smallest, int* address){

int count=0,occ=0;
//loop till last item …
Run Code Online (Sandbox Code Playgroud)

c++ getchar

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

它是标准的C++

此代码编写于C:

int main(){
char Demoshellcode[] ="\xEB\x5D\x5F\x8B\xF7\x80\x3F";
void* addr=0;
addr=&Demoshellcode[0];
__asm call addr
return 0;
}
Run Code Online (Sandbox Code Playgroud)

我们还可以将它视为标准C++代码吗?如果没有,需要进行哪些修改才能使其成为标准C++代码?

c++

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

malloc()的最大大小

可能重复:
malloc可以分配的最大内存!

我怎么知道我可以占用的堆的最大大小malloc().我使用的是MS Visual Studio 2010.

c heap malloc visual-studio

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

进程的内存地址空间

我知道Windows 32位允许任何进程大约2千兆字节的内存地址空间.2千兆字节= 2147483648字节.我试图分配堆内存超过2147483648字节,我没有看到任何错误或异常,这个代码:

# include<iostream>

int main(){

    void *x=malloc(2147489999);
    free(x);
    system("pause");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

是什么原因?

c windows malloc memory-management

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

Oracle SQL Developer中的SQL语句错误

当我尝试在Oracle SQL Developer中执行以下SQL语句时:

CREATE TABLE Nrom1Tab ( Sig TEXT NOT NULL PRIMARY KEY, 
   DocSubject TEXT,  
   DocClassification TEXT,  
   DepName VARCHAR, 
   OrgName TEXT,  
   FromInf  TEXT,   
   ToInf TEXT,    
   DateInf TEXT, 
   NoteInf TEXT );
Run Code Online (Sandbox Code Playgroud)

它显示了这个错误:

在此输入图像描述

sql oracle oracle11g oracle-sqldeveloper

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

在 DataGridView C# 中删除行

我尝试循环遍历dataGridView1并删除不满足以下条件的行:

foreach (DataGridViewRow row in dataGridView1.Rows)
{
    if (!(Convert.ToDateTime(row.Cells[7].Value) - DateTime.Today).Days <= 0)
    {
        dataGridView1.Rows.Remove(row); //error: Uncommitted new row cannot be deleted.
    }
}
Run Code Online (Sandbox Code Playgroud)

但我收到了这个错误:

无法删除未提交的新行。

如果代码也是VB.NET,我可以管理。

.net c# vb.net datagridview row

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

从C#代码后面调用JavaScript

我正在尝试学习asp.net.假设我有这个代码:

if (command.ExecuteNonQuery() == 0)
    {
       // JavaScript like alert("true");
    }
    else
    {
        // JavaScript like alert("false");
    }
Run Code Online (Sandbox Code Playgroud)

如何从C#代码后面调用JavaScript?如何将JavaScript Scripts放在MS Visual Studio中默认创建的目录中?

在此输入图像描述

.net javascript c# asp.net visual-studio

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