Anonymous
a point points to the adress of a variable but its not a memory adress but a pointer has also to a memory adress
Anonymous
bro i mean its a big differnce of that : *pointer and that &reference
Anonymous
anyways, if you try to convert a pointer to an int and that int back to a pointer, and in your machine the size of a pointer is smaller than the size of an int (which is mostly the case), you'll get a trimmed value, and that address will be undefined
Anonymous
Anonymous
Anonymous
Anonymous
no
Anonymous
cpp handles typ safety better
Anonymous
but you right its the same thing
Blue
Cpp is not type safe out of the box. But you can achieve it with disciplined programming
Anonymous
Blue
I dont use c# so I dont know
Anonymous
Kamuri
Kamuri
Anonymous
Kamuri
Anonymous
Hariyana Grande
can we learn data structure along with c lang(im beginner in c lang)?
Shadow
in cpp char arr[10]={'h','e','o'} where will be null character stored?
Vlad
Shadow
in which case null will be stored automatically inside char array?
Vlad
Ammar
It won't be
BTW, it is an exception. If you initialize a sized array partially, the rest will be initialized with zero.
So basically
int arr[3] = {1};
arr[1] and arr[2] will be zero.
Ammar
Ammar
See also https://stackoverflow.com/a/201116/7275114
Anonymous
Ammar
Suppose if it is fully filled?
Then it is what it is filled.
That is not the point anyway. I know exactly what @VoidStar0x0 talking about. He means string literal like "Hello World" ends with null char.
Suka
Anonymous
Ruth
Hey guys
Ruth
#include <iostream>
#include <fstream>
using namespace std;
int n; //Globaal viriable used in forloops in the functions
class Student1
{
public:
string name, fn;
string sex;
double grade;
Student1() {}
Student1(string n, string fn, string s, double g);
void data(Student1 s); //used to display all student info
void filter(Student1 s); //used to filter out female students and display
friend ofstream &operator<<(ofstream &ofs, Student1 &s);
friend ifstream &operator>>(ifstream &ifs, Student1 &s);
};
int main()
{
Student1 s;
Student1 *list[n];
cout << "Enter number of student " << endl;
cin >> n;
for (int i = 0; i < n; i++)
{
cout << "enter name of student number " << i + 1 << endl;
cin >> s.name;
cout << "enter father name of sudent number " << i + 1 << endl;
cin >> s.fn;
cout << "enter Sex of student number M/m" << i + 1 << endl;
cin >> s.sex;
cout << "enter Grade of student number " << i + 1 << endl;
cin >> s.grade;
list[i] = new Student1(s.name, s.fn, s.sex, s.grade);
}
ofstream ofs("regi.txt",ios::app);
for (int i = 0; i < n; i++)
{
ofs << list[i];
}
Student1 student_list;
ifstream ifs("regi.txt");
cout << "student data " << endl;
cout << "***** Name SEX GRADE****" << endl;
for (int i = 0; i < n; i++)
{
ifs >> Student1 list;
}
int choose;
cout<<1 << "enter 1 for to diplay all student data" << endl;
cout<<2 << "enter 2 for to diplay female student data" << endl;
cin >> choose;
switch (choose)
{
case 1:
s.data(s);
break;
case 2:
s.filter(s);
default:
break;
}
}
Student1::Student1(string n, string fn, string s, double g)
{
name = n;
fn = fn;
sex = s;
grade = g;
}
void Student1::filter(Student1 s)
{
if (s.sex == "f" || s.sex == "F")
{
for (int i = 0; i < n; i++)
{
cout << "Name " << s.name << endl;
cout << "Father Name " << s.fn << endl;
cout << "Sex " << s.sex << endl;
cout << "Grade " << s.grade << endl;
cout << endl;
}
}
}
Ruth
#include <iostream>
#include <fstream>
using namespace std;
int n; //Globaal viriable used in forloops in the functions
class Student1
{
public:
string name, fn;
string sex;
double grade;
Student1() {}
Student1(string n, string fn, string s, double g);
void data(Student1 s); //used to display all student info
void filter(Student1 s); //used to filter out female students and display
friend ofstream &operator<<(ofstream &ofs, Student1 &s);
friend ifstream &operator>>(ifstream &ifs, Student1 &s);
};
int main()
{
Student1 s;
Student1 *list[n];
cout << "Enter number of student " << endl;
cin >> n;
for (int i = 0; i < n; i++)
{
cout << "enter name of student number " << i + 1 << endl;
cin >> s.name;
cout << "enter father name of sudent number " << i + 1 << endl;
cin >> s.fn;
cout << "enter Sex of student number M/m" << i + 1 << endl;
cin >> s.sex;
cout << "enter Grade of student number " << i + 1 << endl;
cin >> s.grade;
list[i] = new Student1(s.name, s.fn, s.sex, s.grade);
}
ofstream ofs("regi.txt",ios::app);
for (int i = 0; i < n; i++)
{
ofs << list[i];
}
Student1 student_list;
ifstream ifs("regi.txt");
cout << "student data " << endl;
cout << "***** Name SEX GRADE****" << endl;
for (int i = 0; i < n; i++)
{
ifs >> Student1 list;
}
int choose;
cout<<1 << "enter 1 for to diplay all student data" << endl;
cout<<2 << "enter 2 for to diplay female student data" << endl;
cin >> choose;
switch (choose)
{
case 1:
s.data(s);
break;
case 2:
s.filter(s);
default:
break;
}
}
Student1::Student1(string n, string fn, string s, double g)
{
name = n;
fn = fn;
sex = s;
grade = g;
}
void Student1::filter(Student1 s)
{
if (s.sex == "f" || s.sex == "F")
{
for (int i = 0; i < n; i++)
{
cout << "Name " << s.name << endl;
cout << "Father Name " << s.fn << endl;
cout << "Sex " << s.sex << endl;
cout << "Grade " << s.grade << endl;
cout << endl;
}
}
}
this is my code and i can't compile it ......please help me
Nova
Oleg
there is no implemented function with name "data"
Ruth
Oleg
where? I see Student1 class, main function, constructor and filter. Moreover, you've declared overloading "< <" and "> >" but you have not realized them.
Юрій
Anyone can help, i need to craft upd packet (directly i need to change IP address of sender and receiver, and data sent)
How could I do that, maybe there are any library?
Ruth
ok thanks all😊😊
Ed
Is it recommended to use the goto label? if not what are the implications?
Ed
Ok. Thanks.
Dima
lol
Dima
wtf
Giorgi
Giorgi
I don't understand why the link was deleted
Dima
why does it block wiki links lol
Dima
just paste it with spaces
Giorgi
Spaghetti_code on wikipedia
Giorgi
that is what goto leads to
Dima
https://en.wikipedia.org/wiki/Spaghetti_code
Giorgi
jesus, if I link it gets deleted
Oleg
probably labels are allowed in assembler code,but not exactly in the languages like c++
Anonymous
You little cow
Oleg
Ed
Mar!o
Oleg
Mario, you can kill a lot of people, but you won't, right?
Oleg
Sorry, Au, I can't help you with the loop.
Oleg
ok thanks all😊😊
I tried to rewrite your code as there are many errors in the previous one. Maybe it'll help.
Anonymous
https://pastebin.com/w5SX3qNH
Oleg
I should train)
Giorgi
Question: what libraries do you use most?
klimi
Oleg
stl, boost, qt
.
I have questions e.g there is independent classes having their own linked list structures and there is a another class having a pointer to the node type
Is there any way i can get the head of the first data structures need help
.
Aze
txns rose am seriously interested in c++, learning resources and materials would be appreciated
𝙑𝙞𝙨𝙝𝙖𝙡
Ruth
Anonymous
Thanks for adding me