ברני
i have code it in online compiler but it is showing error
Send the code here in the site you've been told
ברני
http://pastebin.com
Roshan
See
Anonymous
i am not able to send the code here
Anonymous
can i send the picture of code
Nameful
can i send the picture of code
you can, but the admins will warn you
Anonymous
then what can i do now
Anonymous
@swastik yes user will puy the marks
Anonymous
how to do in pastebin
HaiNahi
So we have to test if marks entered meet the conditions or not?
HaiNahi
how to do in pastebin
You can use text uploader website also
Anonymous
@swastik ,yes user will put say 80 % marks then he is pass
HaiNahi
I think don't divide by three u can add the thing upto 300 and check the mark wrt 240 else floats will come
Anonymous
i dont get it
HaiNahi
Take the three marks add it if bigger than 240 pass or else fail
Anonymous
no user will first put his marks in math ,then phy,then chem
HaiNahi
Yeah you can add the three inputs
Roshan
Umm....
Roshan
Give concrete answers Swastik
Roshan
Compact in one message
Anonymous
i want to share my code how will i share photo of code
Dima
photos of code are not allowed here
Dima
screenshots of your code are allowed tho
RC
What's the difference between int main () and void main()?
Roshan
What's the difference between int main () and void main()?
Int returns int data type void doesn't. Also don't use void main() as it is not compiled by some compilers...
Roshan
What's the difference between int main () and void main()?
Also there is no need to write return 0 in int main() as it's a special function. Return 0 is done by itself
RC
Thanks
Roshan
Thanks
Welcome!!
ברני
Most of my tasks require void main
Roshan
in the industry you using void main alot
You dont need to. As int main() is same as void main() in VS
ברני
You dont need to. As int main() is same as void main() in VS
void is when you don't need returns, like if you making a matrix call function you can use void, and void main usually just the main with all the functions, I don't know why, but my friends that works already in the industry usually uses void main on their codes
Igor🇺🇦
What's the difference between int main () and void main()?
One is correct the other one is not. https://isocpp.org/wiki/faq/newbie#main-returns-int
olli
in the industry you using void main alot
I doubt that since gcc yields errors for void main. I have not seen the void version being used in production code
Anonymous
There is only one place where void main is correct, but you guys won’t be interested
ברני
I doubt that since gcc yields errors for void main. I have not seen the void version being used in production code
Maybe only on my country... Im not sure.. Anyway I'm learning C just for the basic.. I want to move to c# afterward
Anonymous
ברני
Definitely not
Maybe in my country then..
ברני
Like in university? :)
Maybe, that's what the university tasks ask you to do here..
Anonymous
void main is not valid C or C++
Anonymous
Maby c#?
Read the chat title please
Anonymous
Minor Spoiler: Where void main() is correct
ברני
Read the chat title please
You said it don't valid on c c++, I said maybe it's on c#, I don't know, I don't think my friends will lie to me.. And on the university that ask you to do void main most of the time...
Anonymous
Minor Spoiler: Where void main() is correct
Well it's not ISO C anyways as you said :)
olli
Returning void from main As a Microsoft extension, the main and wmain functions can be declared as returning void (no return value). This extension is also available in some other compilers, but its use isn't recommended. Even MS recommends not to use void main
ברני
In C# main needs to be static, so it's signature differs as well
So I don't know why it's like that here.. Maybe something with my country..
Anonymous
Because MS loves ISO C++
I wish they loved it from the beginning of C++..
Anonymous
Not only the last decade
Anonymous
Yeah and also question about void main was mentioned on the one of f.a.q. on Stroustrup website
Roshan
Roshan
I didn't answer. Your quotes were at wrong place. scanf("%d",&number); This is the correct order.
Vlad
Because MS loves ISO C++
More like ANSI C :P
Igor🇺🇦
More like ANSI C :P
Microsoft has C++ going native conference since 2012 and employes such members of C++ Standards Committee as Herb Sutter and is constant sponsor of Cppcon I'd say they do love C++. They had most of C99 support only recently. So they don't really love C at all.
MᏫᎻᎯᎷᎷᎬᎠ
I looked up about "literal classes" which will make passing non-type non-primitives as templates parameters possible Apparently for a class to be a literal one of its condition is "All base claases and non-static data members are public and not mutable" Any Idea of why the data members must be public?
MᏫᎻᎯᎷᎷᎬᎠ
But does it answer the question😂?
Yazidi
double mebInfo(int age, int noOfMonths, int noOfsessions) { cout << "Please enter your age: " << endl; cin >> age; cout << "Please enter number of months to charge: " << endl; cin >> noOfMonths; cout << "please enter number of sessions per week: " << endl; cin >> noOfsessions; } double mebCost() { switch(numOfMonth) { case 1: price = 150; break; case 3: price = 400; break; case 6: price = 750; case 12: price = 1400; break } if (age > 60) { price *= 0.30; } if (noOfMonths >= 12) { price *= 0.15; } if (noOfsessions > 5) { price *= 0.20; } return price; }
Yazidi
how can I use the arguments of (mebInfo) function in (mebCost) function?!
Use appropriate parameters to pass information in and out of a function. (Do not use any global variables.)
MᏫᎻᎯᎷᎷᎬᎠ
Anonymous
olli
A type is a literal type if it is: - cv void; or - a scalar type; or - a reference type; or - an array of literal type; or - a possibly cv-qualified class type that has all of the following properties: - it has a constexpr destructor ([dcl.constexpr]), - it is either a closure type ([expr.prim.lambda.closure]), an aggregate type ([dcl.init.aggr]), or has at least one constexpr constructor or constructor template (possibly inherited from a base class) that is not a copy or move constructor, - if it is a union, at least one of its non-static data members is of non-volatile literal type, and - if it is not a union, all of its non-static data members and base classes are of non-volatile literal types. http://eel.is/c++draft/basic.types.general#10
olli
So?
Your link describes a structural type, I thought we were talking about literal types?
Anonymous
Lunatic asked about why class non-type template parameters should have all public members