Dima
Who cares
ばか
Haha
klimi
Who cares
What a warrior
Asad
Ilya
C can do that c++ cant
This is wrong. All c does c++ also can do.
Ilya
There's a reason c is used in kernel
And the reason is only.... Linus Torvalds
Asad
it all defends! for example, i cannot do kernel with c. but, others can... staff like that. language is just a tool. more specific question is whether YOU can do something with c or c++ or whatever. language itself is able to do nothing...
Asad
And the reason is only.... Linus Torvalds
yeah he is in love with with c)
Esha
Can anyone tell me. . About the Local and global scope of a variable?
Esha
??
Esha
/abuse
Anonymous
/abuse
SH
Oh the fire 🔥 that one person can initiate
꧁༒☬kim☬༒꧂
# include <iostream> # include <string.h> # include <stdlib.h> using namespace std; class student { protected: string firstname, secondname, thirdname, regNo, email,course; double YOS; int telNo; public: void setparameters(string m, string n, string o,string p,string q, string t, double r,int s) { firstname=m; secondname=n; thirdname=o; regNo=p; email=q; course=t; YOS=r; telNo=s; } virtual void output() { } }; class GIS : public student { void output() { system("cls"); cout<<"\nName:\t\t"<<firstname<<" "<<secondname<<" "<<thirdname<<endl; cout<<"Reg-No:\t\t"<<regNo<<endl; cout<<"E-mail:\t\t"<<email<<endl; cout<<"Tel-No:\t\t"<<telNo<<endl; cout<<"Course:\t\t"<<course<<endl; cout<<"Y.O.S:\t\t"<<YOS<<endl<<endl<<endl; } }; class GEGIS : public student { void output() { system("cls"); cout<<"\nName:\t\t"<<firstname<<" "<<secondname<<" "<<thirdname<<endl; cout<<"Reg-No:\t\t"<<regNo<<endl; cout<<"E-mail:\t\t"<<email<<endl; cout<<"Tel-No:\t\t"<<telNo<<endl; cout<<"Course:\t\t"<<course<<endl; cout<<"Y.O.S:\t\t"<<YOS<<endl<<endl<<endl; } }; class TELECOMMUNICATION ENGINEERING : public student { void output() { system("cls"); cout<<"\nName:\t\t"<<firstname<<" "<<secondname<<" "<<thirdname<<endl; cout<<"Reg-No:\t\t"<<regNo<<endl; cout<<"E-mail:\t\t"<<email<<endl; cout<<"Tel-No:\t\t"<<telNo<<endl; cout<<"Course:\t\t"<<course<<endl; cout<<"Y.O.S:\t\t"<<YOS<<endl<<endl<<endl; } }; int main() { student S1; GIS st1; GEGIS st2; TELECOMMUNICATION ENGINEERING st3; student *ptr1= &st1; student *ptr2= &st2; student *ptr3= &st3; student *ptr3= &S1; string a,b,c,d,e,f; int g,option; double h; system("color 0a"); cout<<"________________________________________________________"<<endl; cout<<"COLLEGE OF ENGINEERING AND TECHNOLOGY"<<endl; cout<<"________________________________________________________"<<endl; cout<<"\n1. GEGIS\n2. GIS\n3. TELECOMMUNICATION ENGINEERING\n\n Choose your option::"; cin>>option; cout<<"\n\n________________________________________________________"<<endl; if(option==1) { system("cls"); cout<<"\n________________________________________________________"<<endl; cout<<"GEOMATICS ENGINEERING AND GEOSPATIAL INFORMATION SYSTEMS"<<endl; cout<<"\n________________________________________________________"<<endl; cout<<"Firstname::"; cin>>a; cout<<"Secondname::"; cin>>b; cout<<"Lastname::"; cin>>c; cout<<"Registration No::"; cin>>d; cout<<"E-mail::"; cin>>e; cout<<"Tel-No::"; cin>>g; cout<<"Course::"; cin>>f; cout<<"Y.O.S::"; cin>>h; cout<<"\n\n________________________________________________________"<<endl; cout<<"Record done"<<endl; ptr2->setparameters(a,b,c,d,e,f,h,g); ptr2->output(); } else if(option==2) { system("cls"); cout<<"________________________________________________________"<<endl; cout<<"\t GEOSPATIAL INFORMATION SYSTEMS"<<endl; cout<<"________________________________________________________"<<endl; cout<<"Firstname::"; cin>>a; cout<<"Secondname::"; cin>>b; cout<<"Lastname::"; cin>>c; cout<<"Registration No::"; cin>>d; cout<<"E-mail::"; cin>>e; cout<<"Tel-No::"; cin>>g; cout<<"Course::"; cin>>f; cout<<"Y.O.S::"; cin>>h; cout<<"\n\n________________________________________________________"<<endl; cout<<"Record done"<<endl; ptr1->setparameters(a,b,c,d,e,f,h,g); ptr1->output(); } if(option==3) { system("cls"); cout<<"\n________________________________________________________"<<endl; cout<<"TELECOMMUNICATION ENGINEERING"<<endl; cout<<"\n_______________________________________________________
꧁༒☬kim☬༒꧂
"<<endl; cout<<"Firstname::"; cin>>a; cout<<"Secondname::"; cin>>b; cout<<"Lastname::"; cin>>c; cout<<"Registration No::"; cin>>d; cout<<"E-mail::"; cin>>e; cout<<"Tel-No::"; cin>>g; cout<<"Course::"; cin>>f; cout<<"Y.O.S::"; cin>>h; cout<<"\n\n________________________________________________________"<<endl; cout<<"Record done"<<endl; ptr3->setparameters(a,b,c,d,e,f,h,g); ptr3->output(); } else { cout<<"Error!! Wrong input."; } return 0; }
꧁༒☬kim☬༒꧂
Help.me.debug that kindly
Ilya
/abuse
Well if an admin tells you to google, it is kinda stupid idea to report abuse...
Ilya
Help.me.debug that kindly
What is the problem? It would be nice if you put the code on something like hastebin.com
Ilya
# include <iostream> # include <string.h> # include <stdlib.h> using namespace std; class student { protected: string firstname, secondname, thirdname, regNo, email,course; double YOS; int telNo; public: void setparameters(string m, string n, string o,string p,string q, string t, double r,int s) { firstname=m; secondname=n; thirdname=o; regNo=p; email=q; course=t; YOS=r; telNo=s; } virtual void output() { } }; class GIS : public student { void output() { system("cls"); cout<<"\nName:\t\t"<<firstname<<" "<<secondname<<" "<<thirdname<<endl; cout<<"Reg-No:\t\t"<<regNo<<endl; cout<<"E-mail:\t\t"<<email<<endl; cout<<"Tel-No:\t\t"<<telNo<<endl; cout<<"Course:\t\t"<<course<<endl; cout<<"Y.O.S:\t\t"<<YOS<<endl<<endl<<endl; } }; class GEGIS : public student { void output() { system("cls"); cout<<"\nName:\t\t"<<firstname<<" "<<secondname<<" "<<thirdname<<endl; cout<<"Reg-No:\t\t"<<regNo<<endl; cout<<"E-mail:\t\t"<<email<<endl; cout<<"Tel-No:\t\t"<<telNo<<endl; cout<<"Course:\t\t"<<course<<endl; cout<<"Y.O.S:\t\t"<<YOS<<endl<<endl<<endl; } }; class TELECOMMUNICATION ENGINEERING : public student { void output() { system("cls"); cout<<"\nName:\t\t"<<firstname<<" "<<secondname<<" "<<thirdname<<endl; cout<<"Reg-No:\t\t"<<regNo<<endl; cout<<"E-mail:\t\t"<<email<<endl; cout<<"Tel-No:\t\t"<<telNo<<endl; cout<<"Course:\t\t"<<course<<endl; cout<<"Y.O.S:\t\t"<<YOS<<endl<<endl<<endl; } }; int main() { student S1; GIS st1; GEGIS st2; TELECOMMUNICATION ENGINEERING st3; student *ptr1= &st1; student *ptr2= &st2; student *ptr3= &st3; student *ptr3= &S1; string a,b,c,d,e,f; int g,option; double h; system("color 0a"); cout<<"________________________________________________________"<<endl; cout<<"COLLEGE OF ENGINEERING AND TECHNOLOGY"<<endl; cout<<"________________________________________________________"<<endl; cout<<"\n1. GEGIS\n2. GIS\n3. TELECOMMUNICATION ENGINEERING\n\n Choose your option::"; cin>>option; cout<<"\n\n________________________________________________________"<<endl; if(option==1) { system("cls"); cout<<"\n________________________________________________________"<<endl; cout<<"GEOMATICS ENGINEERING AND GEOSPATIAL INFORMATION SYSTEMS"<<endl; cout<<"\n________________________________________________________"<<endl; cout<<"Firstname::"; cin>>a; cout<<"Secondname::"; cin>>b; cout<<"Lastname::"; cin>>c; cout<<"Registration No::"; cin>>d; cout<<"E-mail::"; cin>>e; cout<<"Tel-No::"; cin>>g; cout<<"Course::"; cin>>f; cout<<"Y.O.S::"; cin>>h; cout<<"\n\n________________________________________________________"<<endl; cout<<"Record done"<<endl; ptr2->setparameters(a,b,c,d,e,f,h,g); ptr2->output(); } else if(option==2) { system("cls"); cout<<"________________________________________________________"<<endl; cout<<"\t GEOSPATIAL INFORMATION SYSTEMS"<<endl; cout<<"________________________________________________________"<<endl; cout<<"Firstname::"; cin>>a; cout<<"Secondname::"; cin>>b; cout<<"Lastname::"; cin>>c; cout<<"Registration No::"; cin>>d; cout<<"E-mail::"; cin>>e; cout<<"Tel-No::"; cin>>g; cout<<"Course::"; cin>>f; cout<<"Y.O.S::"; cin>>h; cout<<"\n\n________________________________________________________"<<endl; cout<<"Record done"<<endl; ptr1->setparameters(a,b,c,d,e,f,h,g); ptr1->output(); } if(option==3) { system("cls"); cout<<"\n________________________________________________________"<<endl; cout<<"TELECOMMUNICATION ENGINEERING"<<endl; cout<<"\n_______________________________________________________
don't use this shit in your code, ever... system("cls");
Ilya
# include <iostream> # include <string.h> # include <stdlib.h> using namespace std; class student { protected: string firstname, secondname, thirdname, regNo, email,course; double YOS; int telNo; public: void setparameters(string m, string n, string o,string p,string q, string t, double r,int s) { firstname=m; secondname=n; thirdname=o; regNo=p; email=q; course=t; YOS=r; telNo=s; } virtual void output() { } }; class GIS : public student { void output() { system("cls"); cout<<"\nName:\t\t"<<firstname<<" "<<secondname<<" "<<thirdname<<endl; cout<<"Reg-No:\t\t"<<regNo<<endl; cout<<"E-mail:\t\t"<<email<<endl; cout<<"Tel-No:\t\t"<<telNo<<endl; cout<<"Course:\t\t"<<course<<endl; cout<<"Y.O.S:\t\t"<<YOS<<endl<<endl<<endl; } }; class GEGIS : public student { void output() { system("cls"); cout<<"\nName:\t\t"<<firstname<<" "<<secondname<<" "<<thirdname<<endl; cout<<"Reg-No:\t\t"<<regNo<<endl; cout<<"E-mail:\t\t"<<email<<endl; cout<<"Tel-No:\t\t"<<telNo<<endl; cout<<"Course:\t\t"<<course<<endl; cout<<"Y.O.S:\t\t"<<YOS<<endl<<endl<<endl; } }; class TELECOMMUNICATION ENGINEERING : public student { void output() { system("cls"); cout<<"\nName:\t\t"<<firstname<<" "<<secondname<<" "<<thirdname<<endl; cout<<"Reg-No:\t\t"<<regNo<<endl; cout<<"E-mail:\t\t"<<email<<endl; cout<<"Tel-No:\t\t"<<telNo<<endl; cout<<"Course:\t\t"<<course<<endl; cout<<"Y.O.S:\t\t"<<YOS<<endl<<endl<<endl; } }; int main() { student S1; GIS st1; GEGIS st2; TELECOMMUNICATION ENGINEERING st3; student *ptr1= &st1; student *ptr2= &st2; student *ptr3= &st3; student *ptr3= &S1; string a,b,c,d,e,f; int g,option; double h; system("color 0a"); cout<<"________________________________________________________"<<endl; cout<<"COLLEGE OF ENGINEERING AND TECHNOLOGY"<<endl; cout<<"________________________________________________________"<<endl; cout<<"\n1. GEGIS\n2. GIS\n3. TELECOMMUNICATION ENGINEERING\n\n Choose your option::"; cin>>option; cout<<"\n\n________________________________________________________"<<endl; if(option==1) { system("cls"); cout<<"\n________________________________________________________"<<endl; cout<<"GEOMATICS ENGINEERING AND GEOSPATIAL INFORMATION SYSTEMS"<<endl; cout<<"\n________________________________________________________"<<endl; cout<<"Firstname::"; cin>>a; cout<<"Secondname::"; cin>>b; cout<<"Lastname::"; cin>>c; cout<<"Registration No::"; cin>>d; cout<<"E-mail::"; cin>>e; cout<<"Tel-No::"; cin>>g; cout<<"Course::"; cin>>f; cout<<"Y.O.S::"; cin>>h; cout<<"\n\n________________________________________________________"<<endl; cout<<"Record done"<<endl; ptr2->setparameters(a,b,c,d,e,f,h,g); ptr2->output(); } else if(option==2) { system("cls"); cout<<"________________________________________________________"<<endl; cout<<"\t GEOSPATIAL INFORMATION SYSTEMS"<<endl; cout<<"________________________________________________________"<<endl; cout<<"Firstname::"; cin>>a; cout<<"Secondname::"; cin>>b; cout<<"Lastname::"; cin>>c; cout<<"Registration No::"; cin>>d; cout<<"E-mail::"; cin>>e; cout<<"Tel-No::"; cin>>g; cout<<"Course::"; cin>>f; cout<<"Y.O.S::"; cin>>h; cout<<"\n\n________________________________________________________"<<endl; cout<<"Record done"<<endl; ptr1->setparameters(a,b,c,d,e,f,h,g); ptr1->output(); } if(option==3) { system("cls"); cout<<"\n________________________________________________________"<<endl; cout<<"TELECOMMUNICATION ENGINEERING"<<endl; cout<<"\n_______________________________________________________
This will not compile, why are you asking to debug? class TELECOMMUNICATION ENGINEERING : public student {
Ilya
any alternatives ?
Actually there is no need to do this at all, but if you strictly need this, you can do what CLS does, manually, that is, output N empty lines where N = number of lines in a terminal, at maximum
꧁༒☬kim☬༒꧂
Ilya
...okay help.me eliminate any errors/include what i have to
hometasks must be done individually, they are for this.
Asad
Actually there is no need to do this at all, but if you strictly need this, you can do what CLS does, manually, that is, output N empty lines where N = number of lines in a terminal, at maximum
one more question: can i access base-class-only member functions using base class pointer that's pointing to a derived class object?
꧁༒☬kim☬༒꧂
Ilya
one more question: can i access base-class-only member functions using base class pointer that's pointing to a derived class object?
What is "base-class-only member functions" ? In general, yes, you can, but the answer can change based on your detalisation.
Asad
What is "base-class-only member functions" ? In general, yes, you can, but the answer can change based on your detalisation.
base-class-only member functions are declared in the base class and are not overridden by derived class member functions. answer?
Ilya
one more question: can i access base-class-only member functions using base class pointer that's pointing to a derived class object?
This is Liskov principle, one of main rules in OOP, any object of class that is derived from a base class, can be used as (substituted in place of) a parent class object.
Asad
ah i see. thank you bro
Ilya
Hi is just saying hello....
Ilya
Have you ever used cls? that's not what cls does...
That is exactly what cls does, scrolls the screen down one page
Harsh
That is exactly what cls does, scrolls the screen down one page
Ik about cls but why use system commands ;-;
Joesph
Try it yourself on a common, modern os
Bro dont He's drunk🤣🤣
Anonymous
why in c++ when i have a char[10] in a class for example in constructor i should initialize the char[10] because is autogeneraed?
olli
why in c++ when i have a char[10] in a class for example in constructor i should initialize the char[10] because is autogeneraed?
You shall initizialize variables before you use them otherwise the value might be indeterminate
Anonymous
yeah but no errors everything works when the constructor without parameters is called
Ludovic 'Archivist'
In case of doubt whenever you intitialized everything before use, valgrind is your friend
Ludovic 'Archivist'
yeah but no errors everything works when the constructor without parameters is called
You will not run into problems with 25 lines of codes, but if you have 25k line of code, uninitialized memory you expect to be initialized will hurt you back
Anonymous
i have 10 classes each in separate file
Anonymous
is it necessary to use pragma once?
Joesph
Any proofs?
Justfuckinggoogleit.com
Anonymous
Justfuckinggoogleit.com
Learn some manners, dude https://en.wikipedia.org/wiki/Burden_of_proof_(philosophy)
...
Justfuckinggoogleit.com
this is not how this works, both languages compile to assembly, it is really up to the compiler to do the job on optimization
...
fact is, if you got a significant more efficient algorithm to solve a certain problem, it will impact your performance way more than "using c or c++"
Ludovic 'Archivist'
That's not the whole reason C is faster when used for kernel than c++ and if used c++ it will slower + a long code
This is completely false, from all the tests I could perform, C and C++ performance are comparable, and are all the more comparable in the freestanding implementation of both of them (meaning that compared to the hosted implementation, it has a lower (inexistant) variance of performance)
gallo
Sorry for my question, I want to open a file and write on with C++, but the file is in a folder protected by password, any ideas?
Francisco
Sorry for my question, I want to open a file and write on with C++, but the file is in a folder protected by password, any ideas?
Well, I guess you should run the software that protected that folder in the first place. Otherwise, I don't think there's a way to do it
Anonymous
one question
Harsh
why not
Try googling
Anonymous
if i have on a derived class a pointer should i create
Anonymous
destructor where i delete the pointer
Harsh
Your question seems unclear to me
Anonymous
so i have a main class and a subclass , in each class i have 2 sifferent pointers , i create a destructor for main class , should i create a destructor for subclass ?
Anonymous
where i delete the pointer from derived?
Рома
guys plz help me. I don't understand why my program crashes
Рома
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZE 50 int main() { struct personality { char surname[SIZE]; char name[SIZE]; int day; int month; int year; int marks[5]; double average; struct personality *next; }; struct personality *PZ11; FILE* fp = fopen("list.txt", "r"); int countStuds; int symbol; int i = 0; do { fscanf(fp, "%s %s", &PZ11->surname, &PZ11->name); fscanf(fp, "%d %d %d", &PZ11->day, &PZ11->month, &PZ11->year); for (int j = 0; j < 5; j++) fscanf(fp, "%i", &PZ11->marks[j]); i++; } while (!feof(fp)); fclose(fp); countStuds = i; for (int i = 0; i < countStuds; i++) { printf("|"); printf("%12s %10s \n", PZ11->surname, PZ11->name); ++i; }
Рома
I want to read data from the file to struct using pointer
Anonymous
I want to read data from the file to struct using pointer
Do you know where the program crashes? Put some debug print statements and see where the crash happens or just use gdb
Рома
Рома
I don't know where the problem is because the console doesn't open to me
Dima
Lol