Богдан
The compiler error message should have explained you the issue in the first place
Богдан
Read those in terminal if you compile via terminal, or in tool windows in your IDE if you use one
Muhd
/rules
jaebie
it says in the error that no matching function for call to 'Triangle::Area_Tri()' can someone help me fix this
jaebie
#include<iostream> using namespace std; class Triangle { public: double Area, Peri, Angle; void Area_Tri(double h,double b) { height = h; base = b; Area = ((b*h)*(0.5)); } void Peri_Tri(double j, double b, double m) { side1 = j; side2 = b; side3 = m; Peri = j+b+m; } void Angle_Tri(double ang) { if(ang<90) std::cout<<"The triangle is an acute-angled."; if(ang==90) std::cout<<"The triangle is a right-angled."; if(ang>90) std::cout<<"The triangle is an obtuse-angled."; } private: double height,base,side1,side2,side3; }; int main() { Triangle triangle1; triangle1.Area_Tri(4,6); std::cout<<"The area of the triangle is "<< triangle1.Area_Tri()<<"."; return 0; }
jaebie
here's the code
jaebie
Should I change them to float or int?
jaebie
double
jaebie
the area of the triangle
jaebie
still error :(
jaebie
it says here no matching function for call to 'Triangle::Area_Tri(double&)'
jaebie
Error lol
jaebie
still the same
jaebie
its now working, thank you very much
jaebie
what would be the problem in the code if a random scientific notation occured at the end of the program?
Dafa Pramudya
Hi guys i want to ask, here is my code: class CarWash { public: string jenisLayanan; string status; double discount; public:CarWash() { cout<<"Welcomeeeee" << "\n"; } public:void setValue(string j, string s, double d) { jenisLayanan = j; status = s; discount = d; } virtual int hitungHarga() {return 0;}; }; class CuciMobil:public CarWash{ public:int hitungHarga() { return 75000 - (75000 * discount); } }; class VacumInterior:public CarWash{ public:int hitungHarga() { return 50000 - (50000 * discount); } }; class CuciBagianBawah:public CarWash{ public:int hitungHarga() { return 150000 - (150000 * discount); } }; Why the base class (CarWash) constructor is called 3 times? how to call it once? Thanks
Dafa Pramudya
Because it is inherited... it depends on which constructor you want to call...
It's possible to called once ? (base constructor)
Talula
It's possible to called once ? (base constructor)
Technically I don't know how it is done... but logically I would have a variable that would be made true in the base and if it is true, it'll not return the value but if it is false it will return the value it is returning.
Tolulope
Hello house good ,I need your assistance which of these specs is good for graphics design and programming? 1 Lenovo ThinkPad T440 Corei5 Laptop,128gb SSD/500gb HDD,14 inches screen, windows 10, intel corei5 laptop,4th generation laptop, webcam,3hrs+ battery,slim laptop,8gb ram 2 Core i5, Dual Core 6gb RAM 1TB HDD 4hours Battery power No physical defects. In perfect shape. 3 And this Clean Acer Laptop/Intel inside/ 128ssd/ 8gb ram/11 inches/ 64mb dedicated graphics/ WiFi/Bluetooth
Ludovic 'Archivist'
Hello house good ,I need your assistance which of these specs is good for graphics design and programming? 1 Lenovo ThinkPad T440 Corei5 Laptop,128gb SSD/500gb HDD,14 inches screen, windows 10, intel corei5 laptop,4th generation laptop, webcam,3hrs+ battery,slim laptop,8gb ram 2 Core i5, Dual Core 6gb RAM 1TB HDD 4hours Battery power No physical defects. In perfect shape. 3 And this Clean Acer Laptop/Intel inside/ 128ssd/ 8gb ram/11 inches/ 64mb dedicated graphics/ WiFi/Bluetooth
Graphics design definitely requires a dedicated GPU and the bigger the better. None of those boxes seem particularly suitable. The T440 is definitely not good enough, the one with 6GB of RAM doesn't have enough (but that can be fixed), the last one may be OK (?) but the tiny ass screen and tiny GPU will make it very hard
Aquatica
@admin
Aquatica
(che tristezza)
Roxifλsz 🇱🇹
Aquatica
Elaborate
“how sad”
Roxifλsz 🇱🇹
:(
Aquatica
The spam link was in Italian so I assumed he is Italian as well
Anunay
/warn offtopic, blockchain and potential promotion
Pablo
Guys
Pablo
The strtof function is separing the integer part from the decimal part of my number Same thing with the atof function
Pablo
I pass to it like "4.654" and it returns me 4 And puts .654 in the second string
Pablo
Honestly wt f
Pablo
What is your locale?
yeah that was the problem
Ludovic 'Archivist'
yeah that was the problem
Always is. Locales, timezones and leap seconds are always the problem
Pablo
it was portuguese
Pablo
so floating numbers had , instead of .
Ludovic 'Archivist'
so floating numbers had , instead of .
Yeah, same as French locale
Ludovic 'Archivist'
Always is. Locales, timezones and leap seconds are always the problem
Oh, I forgot half-closed TCP connections on this list
Ludovic 'Archivist'
Those also are an advanced form of headache
inspiroman
how to do union of two linked list using struct node? please anyone help me out.
No Name
Can someone help me on discord? I have segmentation fault after calling a function in the second time when I use malloc
Ravindu Ishara
I want to make a programming IDE for myself. How do I get started ? Any one can help me..? To microcontroller programming...
SLC
If you have a char c = "x4ey3"; How do you extract each integer and make them as integer data type each one??
SLC
i can extract the integer from character but i can't make each integer to integer data type
SLC
atoi is use fro character to integer but it work char c = '4;
SLC
cout« atoi(c) it will give you integer 4
SLC
yes
Ehsan
for (const char cc : c) (int)cc;
SLC
#include<bits/stdc++.h> using namespace std; int main(){ //int num=1||2||3||4||5||6||7||8||9||0; char c[100]; int ar[50]; cin>>c; //cout<<strlen(c); for(int i=0; i<strlen(c); i++){ if(c[i]>='0' && c[i]<='9'){ ar[i]=atoi(c[i]); } } }
SLC
arr[i] = atoi(c[i]); dose not working ???
Ster-Devs
arr[i] = atoi(c[i]); dose not working ???
You haven't initialize the table c yet
SLC
char c[100];
SLC
i initialize
SLC
see carefully in 5th line
Captain
arr[i] = atoi(c[i]); dose not working ???
atoi() takes string as input not char
Captain
Try this ar[i] = int(c[i])-'0'
Mr. O
Please assist
Mr. O
#include <stdio.h> void *str_rev(char *str); int main() { str_rev("abcdefghijklmnopqrst"); } void *str_rev(char *str) { int i, j, k = 0; for (i = 0; str[i] != '\0'; i++) ; i -= 1; char rev[222]; for(j = 0; j < i; j++) { rev[j] = str[i]; i--; } rev[j] = '\0'; printf("%s", rev); }
Mr. O
i am not getting the right result
`` 🇫🇷 ;; ce serai ta blonde ce soir, si c'est ce que tu aimes
i am not getting the right result
Why did you declare void pointer as return type and returning nothing?
Mr. O
Mr. O
I am getting half of the result instead of full result
`` 🇫🇷 ;; ce serai ta blonde ce soir, si c'est ce que tu aimes
The fact that you have at least some result is a miracle
`` 🇫🇷 ;; ce serai ta blonde ce soir, si c'est ce que tu aimes
So, you can delete the first for loop because C has strlen function
Daulet
Daulet
What result you want?
Is it "abcdefghij"?
Mr. O
I want the reverse of the input
Daulet
I want the reverse of the input
Reverse all of string?
Mr. O
Yes
`` 🇫🇷 ;; ce serai ta blonde ce soir, si c'est ce que tu aimes
So, you can delete the first for loop because C has strlen function
And if you just want to print reversed string you can do for (size_t i = strlen(str) - 1; i; --i) { putchar(str[i]); } putchar('\n');
Mr. O
I got tsrqponmlk
Daulet
I got tsrqponmlk
for(j = 0; j <= i; j++) { rev[j] = str[i - j]; }
Daulet
I got tsrqponmlk
is it work?
Mr. O
Thanks Daulet, it worked