Anonymous
where do i put that
Alim
Cars(int cYear, string cMake , int cSpeed)
Anonymous
is that the regular constructor?
Alim
regular constructor
Anonymous
Alim
Anonymous
ok where do i put the regular and default
Alim
like method
Anonymous
like method?
Anonymous
what does that mean?
Anonymous
where is the default
Anonymous
thats the finished code?
Alim
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
class Cars
{
private:
int year;
string make;
int speed;
public:
Cars() = default; // default constructor
Cars() // default constructor
{
//....
// code
//....
}
Cars(int cYear, string cMake , int cSpeed) // regular constructor
{
year = cYear;
make = cMake;
speed = cSpeed;
}
void setYear(int y) { year = y; }
int getYear() { return year; }
void setMake(string m) { make = m; }
string getMake() { return make; }
void setSpeed(int s) { speed = s; }
int getSpeed() { return speed; }
};
int main()
{
return 0;
}
Anonymous
how do i know if its right or not
Anonymous
wait what?!
Alim
Anonymous
why does the default constructor have to have code in it if its default?
Alim
default constructor has not parametrs
Anonymous
so where it says // code // i put nothing?
Alim
Cars(){} - also default constructor
Anonymous
theres two default constructors?
Anonymous
http://prntscr.com/jzbpi8
Anonymous
why did you put two?
Alim
Anonymous
whats for example?
Anonymous
i want the final code not the example because now youre confusing me
Anonymous
which one is right?!
Alim
delete second default constructor
Anonymous
ok
Anonymous
i ran it and it didnt work
Anonymous
// ConsoleApplication15.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
class Cars
{
private:
int year;
string make;
int speed;
public:
Cars() = default;
Cars(int cYear, string cMake, int cSpeed)
{
year = cYear;
make = cMake;
speed = cSpeed;
}
void setYear(int y) { year = y; }
int getYear() { return year; }
void setMake(string m) { make = m; }
string getMake() { return make; }
void setSpeed(int s) { speed = s; }
int getSpeed() { return speed; }
};
int main()
{
return 0;
}
Anonymous
it said "press any key to enter"
Alim
int main()
{
return 0;
}
cin »
cout «
??
Anonymous
what?
Anonymous
oh my god you are confusing me what the heck
Anonymous
never mind holy fucking shit
Alim
int main()
{
return 0;
}
nothing here
Stanislav
Anonymous
Hello world :P pun intended
I recently started to learn to code, i started with C++ on visual studio 2017
But i read and decided to start learning C first, to get a better grasp on programming
So i was adviced to start with a book called
computer systems: a programmer's perspective 3rd edition
Anonymous
Please help and if anyone has the book it be much appreciated
Stanislav
Stanislav
and for C you can't use VC++ :/ it's non comformant to C
Anonymous
They told me that c helps with getting better grasp of the Procedural aspect of coding
Stanislav
Anonymous
Like what will the computer do with the code
Anonymous
Stanislav
Stanislav
and more effective
Stanislav
see constexpr...
Anonymous
ehuehuehe
Anonymous
https://twitter.com/twitter/statuses/971019559095427075
Stanislav
Anonymous
I'm totally new and i thought maybe starting with c as the basic is better
Stanislav
you can write in C style, and what you want
Anonymous
The word multiparadigmic alone scares me
Stanislav
Novus
Hello. I have read the pinned massage
Anonymous
Can someone clarify for me, is it considered better practice to include variable names in function prototypes? I've always been told it's bad practice to include them but I've heard from others recently that it's good practice to include them
Anonymous
Hello admin!😁
Anonymous
Can u tell me best book of C/C++ beginners
Anonymous
Hello admin can you tell me that in 3 years a best software engineer can be made
Anonymous
That's a bot
Anonymous
#cpp
Anonymous
books are in that link
M.
Anonymous
Pls.. give me link for kali linux in windows 64 bit....
Anonymous
Kali Linux is operating system of hacker..
Anonymous
yeah, I'm aware of what Kali is, but asking for a copy of an operating system for a different operating system makes no sense at all
Anonymous
Ohk
Mike
correctmaninwrongplace
Max
Can someone clarify for me, is it considered better practice to include variable names in function prototypes? I've always been told it's bad practice to include them but I've heard from others recently that it's good practice to include them
imagine using this:
int foo(int, int, int, int, char*, char*, char*, int);
vs this:
int foo(int year, int month, int day, char *id, char *address, char *parent_id, int priority);
Anonymous
Yeah, that's a very good point
Krithik Kumar
Hi
Krithik Kumar
Guys
Krithik Kumar
Iam studying computer science in btech
Krithik Kumar
I have completed my 1st year