Cri | ferrosxlupus
Send It if you want
Cri | ferrosxlupus
I think
Azhar
#include<iostream>
using namespace std;
class Test
{
private:
int x;
public:
Test(int x = 0) { this->x = x; }
void change(Test *t) { this = t; }
void print() { cout << "x = " << x << endl; }
};
int main()
{
Test obj(5);
Test *ptr = new Test (10);
obj.change(ptr);
obj.print();
return 0;
}
Azhar
Ermin
What's problem with my code can anyone fix it ?
You can dereference this and t (*this=*t) and that will work
#include<iostream>
using namespace std;
class Test
{
private:
int x;
public:
Test(int x = 0) { this->x = x; }
void change(Test* t) { *this = *t; }
void print() { cout << "x = " << x << endl; }
};
int main()
{
Test obj(5);
Test* ptr = new Test(10);
obj.change(ptr);
obj.print();
return 0;
}
Alviro Iskandar
Anonymous
Ggtt
ᅠ
Imgui
Дмитрий
Guys, can you help with a piece of code in C: in general, 3 arrays and 2 array sizes are passed to the function. Array u with elements from (1 to 10 ) and a , with elements specified by the user (the main thing is that they are included in u), as well as their sizes , size u = 10 , and the size of a is respectively set by the user . So, you need to write elements in the form of 0 and 1 to the third array, 1 will be where the index of the array u during the cycle from 1 to 10 will match the value of the element that is in A, and in the remaining positions from 1 to 10 there will be 0
Anonymous
A serial transmission line can transmit 960 characters a second. Write a program that will calculate how long it will take to send a file, given the file's size. Try it on a 400MB (419,430,400 byte) file. Use appropriate units. (A 400MB file takes days.) c++
Anonymous
Christian
/get
Дмитрий
/get
Дмитрий
E
can anyone help with this pls
Write a small program (can be just a main program without any functions) that reads the standard input and copies what it reads to the output so that is it a valid C string constant. In other words if it reads in the string
EECS 2031
Linux and C
it produces:
"EECS2031\n\
Linux and C"
In other words it replaces new lines with \n\ followed by a new line. It also replaces double quotes with backslash followed by double quotes.
So, if it reads in the string
EECS 2031
"Linux and C"
it produces:
"EECS 2031
\"Linux and C\""
Anonymous
Ali
Assume that you will design a Hotel Management Software (HMS).
What are the objects in a Hotel? List at least 10 objects which need to be stored in the HMS.
Abstract those objects and list their properties and behaviours as Class Box Diagram. Find and show at least 2 different inheritance relationship between classes.
Anonymous
Hello everyone, I live in Uzbekistan
Anonymous
I need your help
Anonymous
Are there any people in this group who know the C # programming language?
Anonymous
Please answer me
klimi
Please answer me
Dear Mr. Developer, indeed in this group of over 16k members are present people who have the knowledge of C#. Hope that helps
Anonymous
Anonymous
If I write and use a program in the C # programming language, it will work on my computer But I compilation it to exe file does not work on other computers
klimi
Anonymous
Anonymous
I'm sorry, I don't speak English very well
Anonymous
Anonymous
Prince Of Persia
Prince Of Persia
Prince Of Persia
And google.com
Prince Of Persia
I have learned a lot from them
Anonymous
And google.com
Google doesn’t always help like a living person, so I asked for help from the iss
Prince Of Persia
klimi
What a rule
This is primarily c/c++ group... As stated in the name. Also for your issue, make sure that the second system has the required runtime as that can cause problems on really any system (be it Linux or eh... Windows)
klimi
Anonymous
I used to work on these programs before Blender After Effects Premiere Pro Pf Track Boujou Cinema 4D Photoshop and now I am interested in programming and want to learn
Anonymous
klimi
Having Google is nice, having good documentation/manual pages is even better
Anonymous
Anonymous
Anonymous
Anonymous
what error message do you get my friend?
This error occurs on another computer The Installer was interrupted before /Program Name / could be installed. You need to restart the installer try again
Azhar
Nana
Pls I want to generate random numbers in such a way that there is no duplicate
Nana
#include <iostream>
#include <vector>
#include <ctime>
#include <cstdlib>
using namespace std;
void intro();
int main()
{
intro();
vector<int>vect;
vector<int>nonRepeat;
int size;
int num;
int min = 1, max = 10;
int val;
cout<<"\t\tEnter the size of the vector: ";
cin>>size;
cout<<endl;
unsigned seed = time(0);
srand(seed);
for(int count = 0; count < size; count++)
{
num = (rand() % (max - min +1)) + min;
vect.push_back(num);
}
cout<<"\t\tHere are the numbers\n";
cout<<endl;
for( int count = 0; count < size; count++)
{
cout<<"\t\tNum #"<<count + 1<<" = "<<vect[count]<<endl;
}
return 0;
}
void intro()
{
cout<<"\t\tThis is a c++ program\n";
cout<<"\t\t----------------------------\n";
cout<<endl;
}
Nana
Thirty
#rose_as_my_girlfriend
Thirty
#reading-cdecl
Thirty
#best-book
Thirty
#learn
J
This is C++ group. Is there any reason you are still on Win8? Anyway, the solution is
Google Android Studio
Open the website and download Android Studio for Win8
Long
#ide
Long
#cbook
Md. Sakib
any ans??
Alviro Iskandar
Alviro Iskandar
dont spam
Md. Sakib
no stupid
not see next question stupid !
Alviro Iskandar
Alviro Iskandar
do your homework yourself
Anonymous
Hello, I have a question. I know that the number of conversion specifiers must exactly match the number of input data. I'm just curious, it was stated that blank spaces are skipped when looking for an integer.
int x;
scanf("%d", &x);
printf("%d", x);
input: 3 5
output: 3
expected output: 35
Why is that? I learned that when looking for an integer, it will skip whitespace characters if needed. Furthermore, when an item is matched correctly, the scanning will continue until it matches an item that cannot possibly belong to the item, right? So it will skip the blank spaces after the 3, and it will read 5, yet 5 can belong to x since it is an integer value. I'm just curious about scanf, and I want to learn more about it. I know that if I am going to input two integers, I must add another conversion specifier in the format string. Thanks!
klimi
Hello, I have a question. I know that the number of conversion specifiers must exactly match the number of input data. I'm just curious, it was stated that blank spaces are skipped when looking for an integer.
int x;
scanf("%d", &x);
printf("%d", x);
input: 3 5
output: 3
expected output: 35
Why is that? I learned that when looking for an integer, it will skip whitespace characters if needed. Furthermore, when an item is matched correctly, the scanning will continue until it matches an item that cannot possibly belong to the item, right? So it will skip the blank spaces after the 3, and it will read 5, yet 5 can belong to x since it is an integer value. I'm just curious about scanf, and I want to learn more about it. I know that if I am going to input two integers, I must add another conversion specifier in the format string. Thanks!
In this case I think it skips the white spaces before first non-space character, in this case 3 and ends when it find another whitespace
Marcio
Mario
hi, could someone help me with a program?
♡︎ 𝑅 ꪖ ڶ ㅤ◡̈⃝ㅤ
Andriel
hi
coolthought
Union and struct are very similar except the way memory location is stored. So far I have only use struct. Is there a situation where union is preferred or better? Anyone has any experience to share?
Marcio
Union is to be used when you want to treat the same region in memory in different ways.
union {
char a[2];
int b;
}
In this case, you can access de 2 byte-information as a vector of 2 char OR as an int, because they occupy the same memory space.
SMS
SMS
(they just look similar, seems the only difference is in the keyword.
Krishnaa
class KthLargest {
public:
int K;
vector<int> v;
KthLargest(int k, vector<int>& nums) {
v=nums; K=k;
make_heap(v.begin(), v.end());
}
int add(int val) {
v.push_back(val); push_heap(v.begin(), v.end());
return v[K-1];
}
};
/**
* Your KthLargest object will be instantiated and called as such:
* KthLargest* obj = new KthLargest(k, nums);
* int param_1 = obj->add(val);
*/
Nana
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <vector>
#include <random>
using namespace std;
void intro();
int main() {
intro();
vector<int> vect;
vector<int> nonRepeat;
int size;
int num;
int min = 1, max = 10;
cout << "\t\tEnter the size of the vector: ";
cin >> size;
cout << endl;
srand(time(0));
while (vect.size() < size) {
num = (rand() % (max - min + 1)) + min;
vect.push_back(num);
for (size_t i = 0; i < vect.size() - 1; i++) {
if (vect[i] == num) {
vect.pop_back();
break;
}
}
}
cout << "\t\tHere are the numbers\n";
cout << endl;
for (int count = 0; count < size; count++) {
cout << "\t\tNum #" << count + 1 << " = " << vect[count] << endl;
}
return 0;
}
void intro() {
cout << "\t\tThis is a c++ program\n";
cout << "\t\t----------------------------\n";
cout << endl;
}
Nana