Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debuged #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Empty file.
Binary file added .vs/APLabGitPractice/v17/.wsuo
Binary file not shown.
Binary file added .vs/APLabGitPractice/v17/Browse.VC.db
Binary file not shown.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": "No Configurations"
}
6 changes: 6 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ExpandedNodes": [
""
],
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
15 changes: 8 additions & 7 deletions 1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
using namespace std;

class container {

protected:
int size;
public:
float* p;
container(int s) :size(s){}
const int& getsize() { return size;}
int& getsize() { return size;}

};

class vector :public container {

int call_num;
public:
explicit vector(int l) :len(l),size(1 * 100){
explicit vector(int l) :len(l),container(1 * 100){
p = new float();
}
int len;
int& getlen() const {
int& getlen() {
call_num ++;
return len;
}
Expand All @@ -29,12 +29,13 @@ class vector :public container {
int main() {

container c1(100);
vector v1 = c1;
vector vc1(1);
vector v1 = vc1;
container& r1 = v1;
container c2 = 100;
c2.getsize() = 20;
cout << c2.getsize();
vector v2 = 100;
v2.getlen = 40;
vector v2 ( 100);
v2.getlen() = 40;
cout << v2.getlen();
}
5 changes: 3 additions & 2 deletions 3.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include<stdio.h>
#include<stdio.h>
#include<stdlib.h>
#define MAX_SIZE 200
int arr[MAX_SIZE];
Expand Down Expand Up @@ -97,7 +97,7 @@ int average()
return sum / count;
}

void main()
int main()
{
int cmd;
long long int x;
Expand Down Expand Up @@ -133,4 +133,5 @@ void main()
exit(0);
}
}
return 0;
}