حسام
Papa
Hey! Can anyone tell me why we use protected in case of private and public:
Chandresh
While protected method is accessible to any class in different package... which extends the class where protected methos is declared..so protected method is visible to other class only if the class extends the protected method's declaration class.
Papa
Ok thanks
Andrey
/get
Andrey
/get best
Jessy
Jessy
Diego
Thank you☺
I still recommend starting with C++ though, but as that person said, focusing on the procedural aspect of the language
Diego
Focus on C++ for now, and you'll appreciate the differences in time
Diego
You'll thank me (probably)
حسام
Good evening everyone.
I’m stuck with this problem for two days and it’s really simple but I’m still learning the basics so excuse me.
I’m supposed to creat 3 functions the first one is supposed to be to enter an array of 7 string and the second one is to check whether the strings in the array are palindrome and the third is to only print the palindrome string.
I could use any help tbh I’ve got the inputting correct and the outputting is half correct because it’ll print the whole array not only the palindrome ones.
حسام
Here’s my code for reference
حسام
#include <iostream>
using namespace std;
#include<string.h>
void inputstring(string arraystr[7]);
void palindrome(string str[7],string result);
void Printstring(string array[7]);
int main()
{
string array1[7]; string r;
inputstring(array1);
palindrome(array1,r);
Printstring(array1);
}
void inputstring(string arraystr[7)
{
int i; string str;
for (i = 0; i < 7; i++)
{
cout << "enter the string number " << i + 1 << ": \n";
cin >> arraystr[i];
}
};
void palindrome(string str[7], string result)
{
string str1, revstr;
if (str1 != revstr)
{
result = false;
}
else
result = true;
};
void Printstring(string array[7])
{
cout << "the palindrome strings are: \n";
for (int i = 0; i < 7; i++)
cout << array[i] << " ";
}
حسام
man c++ is hard or am I just dumb
oldherl
Vala
#include <iostream>
using namespace std;
#include<string.h>
void inputstring(string arraystr[7]);
void palindrome(string str[7],string result);
void Printstring(string array[7]);
int main()
{
string array1[7]; string r;
inputstring(array1);
palindrome(array1,r);
Printstring(array1);
}
void inputstring(string arraystr[7)
{
int i; string str;
for (i = 0; i < 7; i++)
{
cout << "enter the string number " << i + 1 << ": \n";
cin >> arraystr[i];
}
};
void palindrome(string str[7], string result)
{
string str1, revstr;
if (str1 != revstr)
{
result = false;
}
else
result = true;
};
void Printstring(string array[7])
{
cout << "the palindrome strings are: \n";
for (int i = 0; i < 7; i++)
cout << array[i] << " ";
}
Eturnus
remove semicolon in 7th line from below
Eturnus
also remove in 17th line from below
Eturnus
there us an error in
result = false; <=this line
Eturnus
11 th line from below
حسام
Anonymous
Hi.
How to web programming with pure c?
Anonymous
Anonymous
CGI
Can you send me reference?
Anonymous
Why do you need C to do web programming?
Anonymous
http://jkorpela.fi/forms/cgic.html
Lion
courageous approach
J
man c++ is hard or am I just dumb
@Hosam_47 my advice for you to learn c++ quickly will be to go learn the basics about the program. Learn the fundamentals. When you're sure you call do the basic like simple arithmetic, then go on to complex. And make sure your learning curve always involve exercises. Then after learning the complex, then go on to system analysis and all that. But first get the basics and fundamentals right. Jumping from concepts to concepts will get you confused. Learn the basics first
Anonymous
Shinchan_OP
Shinchan_OP
C is not a lang for you
Lion
using CGI is quite simple though, for fun. it's basically 'stdio as a port 80 service'.
Talula
Talula
Hi.
How to web programming with pure c?
For Server Side you could use C# instead of Pure C, but if you want to use Pure C, use CGI...
http://jkorpela.fi/forms/cgic.html
This tells you how to do that... you can do it but it's going to be real pain.
Anonymous
Anonymous
Anonymous
Janko Ⓥ
Anonymous
Anonymous
Nameful
Anonymous
lol
HeyMilkshake - 🇵🇹
Anonymous
When you're using C APIs, for Memory Management and prevent nasty Wrappers on The API's consider to using this:
https://www.boost.org/doc/libs/1_75_0/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL.html
HeyMilkshake - 🇵🇹
Cesco
sorry
Cesco
srand(time(NULL));
n=rand()%2;
if(n==1){cout<<"testa";}
else{cout<<"croce";}}}
i have all the time "croce", i can't understand why.
tim
have you tried printing the result of rand()?
tim
before you apply mod
Cesco
Anonymous
Ludovic 'Archivist'
Or that the rand function is pure trash which may be the truth of the situation
Anonymous
Hey guys can I ask a question?
Andrew
yes
Anonymous
There's something wrong with my code and I'm pretty sure I missed something
Anonymous
#include <iostream>
using namespace std;
int main()
{
int year;
int month;
int perYear=12;
double yearIn_decimal;
cout<<"Enter your age in years"<<"\n";
cin>>year;
cout<<"Enter how many months it's been since your date of birth"<<"\n";
cin>>month;
for(int x=0;month>=0;x++)
{
if(x=0){
cout<<"Your total age is"<<"\n"<<year<<endl; }
else if(x>0) {
yearIn_decimal=year+month/12;
cout<<"Your age in precision is"<<"\n"<<yearIn_decimal<<endl;
}
return 0;
}
}
Anonymous
I think it's got something to do the for loop I used
Vitaliy ◀️TriΔng3l▶️
Anonymous
Vitaliy ◀️TriΔng3l▶️
ah, no, the loop wouldn't be infinite here, but it's pretty pointless still
Anonymous
Otumian
if(x=0)
Anonymous
if(x=0)
Yeah if we assign a value zero right?
Vitaliy ◀️TriΔng3l▶️
What do you mean?
As a thought experiment, can you express your loop in terms of while rather than for? And try to execute it in your mind
Otumian
Anonymous
Anonymous