小编anu*_*294的帖子

复制构造函数

可能重复:
为什么复制构造函数应该通过C++中的引用接受其参数?

为什么复制构造函数的参数是通过引用传递的?

c++

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

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

一个类的对象数组

#include<iostream.h>
class test{
    int a;
    char b;
public:
    test()
    {
        cout<<"\n\nDefault constructor being called";
    }
    test(int i,char j)
    {
        a=i;
        b=j;
        cout<<"\n\nConstructor with arguments called";
    }
};
int main()
{
    test tarray[5];
    test newobj(31,'z');
};
Run Code Online (Sandbox Code Playgroud)

在上面的代码片段中我们可以将值初始化为tarray[5]

c++

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

默认和参数化构造函数

这个陈述是否正确,声明带参数的构造函数会隐藏默认构造函数,并且您无法调用默认构造函数.

c++

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

c ++中的递归和内联函数

谁能告诉我内联函数和递归函数之间的主要区别?

c++

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

C++中的类和对象

class anurag
{
private:
int rollno;
char name[50];
int marks;
float percen;
void percentage(int num)   
{
 percen=(num/500)*100;

}
public:
void getdata(void)
{
cout<<"\n\nEnter the name of the student:";
gets(name);
cout<<"\n\nEnter the roll no: and the marks:";
cin>>rollno>>marks;
percentage(marks);
}
void display(void)
{
cout<<"\n\nThe name of the student is:";
cout.write(name,50);
cout<<"\n\nThe roll no: of the student is:";
cout<<rollno;
cout<<"\n\n The marks obtained is:"<<marks;
cout<<"\n\nThe percentage is:"<<percen;
}};
   void main()
   {
clrscr();
anurag F;
F.getdata();
F.display();
getch();
   }
Run Code Online (Sandbox Code Playgroud)

为什么以下代码没有提供所需的输出?

c++ turbo-c++

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

标签 统计

c++ ×6

turbo-c++ ×1