Stefan
what kind of hacker?
Stefan
the mit hackers that pursuit hacker culture which is basically software freedom (aka guru like rms) or the people who seek chaos and mayhem in the cyberspace?
Stefan
my life started as the latter defintion, now im trying my best to be the former
Stefan
i mean, its okay, thats my cringy and edgy childhood (to be precise, adolescent), and in adulthood, dont do this again, not ever. fight for freedom instead of being the asshole who attack the server of others im pretty certain you will regret this childhood path
Stefan
but it is not late to make a better world to join the people to be a defender of cyberspace too, though i will always keep myself a grey hat
INDIA
Does any body know a good tutor or website , material for learning jsp and servlet Plz tell me It's a request
Anonymous
Does any body know a good tutor or website , material for learning jsp and servlet Plz tell me It's a request
I know a website. I don't know what you want exactly but I use w3schools.com
INDIA
Is this satisfactory?
No sir it's not that good in jsp and servlet
Anonymous
No sir it's not that good in jsp and servlet
What do you mean by jsp and servlet?
Anonymous
You mean javascript?
Anonymous
You mean javascript?
If so use udacity
Anonymous
Well I'm no good then
Anonymous
Sorry
ـ
/get help
Anonymous
#c++_isnt_c_with_classes
Anonymous
#c++_isnt_c_with_classes
Anonymous
hmmmmmmm
INDIA
Sorry
No sir
Alberto
Hello I have this assignment to do, I have struggled hours but I cant get through it, can someone give me a hint?
Anonymous
No sir
Yes? You rang?
Alberto
A text file (for example: source.txt) contains a text with unknown number of lines. Assume that the file DOES NOT contain the character ‘$’. The aim of the program is to compress the file, by replacing any sequence of repeated characters (with a minimum of 2 and a maximum of 9 repetitions) with the following triplet of characters: <repeated character>$<number of repetitions>. NB: the number of repetitions should not consider the first occurrence of the character: for example, AA contains 1 repetition, BBB contains 2 repetitions, etc. In case a character is repeated more than 9 times, the sequence should be broken into multiple sub-sequences. For example: - “AAAAAAAAAAAAA” should be encoded as “A$9A$2” - “the number 1000000 is large” should be encoded as “the number 10$5 is large” - “there are 15 repeated = : =============== and 4 dots….” should be encoded as “there are 15 repeated = : =$9=$4 and 4 dots.$3” The compressed text should be stored in a second file (for example: compressed.txt). Example: If input file source.txt is: Partenza Destinazione Costo Parigi New York 1000 Roma Londra 700 Sidney Los Angeles 2222 The file compressed.txt should be: Partenza $5Destinazione $3Costo Parigi $9New York $410$2 $4Roma $9 Londra $5700 $2Sidney $6Los Angeles $42$3
Alberto
https://paste.ubuntu.com/p/34CB5837Yj/
Alberto
This is my code
Janko Ⓥ
#c++_isnt_c_with_classes
You're right, it's worse
Janko Ⓥ
A text file (for example: source.txt) contains a text with unknown number of lines. Assume that the file DOES NOT contain the character ‘$’. The aim of the program is to compress the file, by replacing any sequence of repeated characters (with a minimum of 2 and a maximum of 9 repetitions) with the following triplet of characters: <repeated character>$<number of repetitions>. NB: the number of repetitions should not consider the first occurrence of the character: for example, AA contains 1 repetition, BBB contains 2 repetitions, etc. In case a character is repeated more than 9 times, the sequence should be broken into multiple sub-sequences. For example: - “AAAAAAAAAAAAA” should be encoded as “A$9A$2” - “the number 1000000 is large” should be encoded as “the number 10$5 is large” - “there are 15 repeated = : =============== and 4 dots….” should be encoded as “there are 15 repeated = : =$9=$4 and 4 dots.$3” The compressed text should be stored in a second file (for example: compressed.txt). Example: If input file source.txt is: Partenza Destinazione Costo Parigi New York 1000 Roma Londra 700 Sidney Los Angeles 2222 The file compressed.txt should be: Partenza $5Destinazione $3Costo Parigi $9New York $410$2 $4Roma $9 Londra $5700 $2Sidney $6Los Angeles $42$3
That should be really simple. Though I disagree with "AA" being "compressed" into "A$2", but rather, this compression should only be done on characters appearing more than twice. But that's irrelevant if the assignment has that specific request. Anyway, you need to have two "modes", you'll loop through the characters (getc()) and once a character is the same as the previous one, enter a nested loop which will count more repeating characters. If the characters don't repeat, you exit the nested loop and continue in the main loop.
Janko Ⓥ
Or at least that's how I'd do it, char by char. I'm not quite sure how else you'd do that
Alberto
https://paste.ubuntu.com/p/34YYcMsWS6/
Alberto
I don't understand why it doesnt work
Janko Ⓥ
If you're comparing single characters, you don't need strcmp(), you can just do (ch == ch2), since characters have an integer value. Let me check the rest
Janko Ⓥ
I don't understand why it doesnt work
Correct me if I'm wrong, but fgets() grabs an entire line, not a character. Right?
Alberto
Right
Janko Ⓥ
Oh nevermind
Alberto
I’ve tried debugging and even if the first two characters of the input file are different, the program enters the while loop and the nested ifs
Janko Ⓥ
Does it have no output?
Alberto
Yes, no output
Janko Ⓥ
I'm getting pretty close to the solution, I just have a bug
Janko Ⓥ
Yes, no output
http://ix.io/2VeK "How are yoooou" becomes "How are yoo$4u"
Janko Ⓥ
Lol
Janko Ⓥ
It's printing a character twice when it repeats
сумбула
can anyone teach me, please what does "\f" do in c++?
Rukiye
can anyone teach me, please what does "\f" do in c++?
https://stackoverflow.com/questions/4334370/escape-sequence-f-form-feed-what-exactly-is-it
Gustavo
Sorry if it's silly, it's my first time implementing an allocator class 😅
Jessy
Please I'm new at C and C++ programming. Any advice to get started?
Anonymous
Jessy
https://www.stroustrup.com/programming.html
Thank you. Should I start with C, C++ or C# ? I heard they are all different.
Anonymous
Thank you. Should I start with C, C++ or C# ? I heard they are all different.
They all completely different, i suggest you C++. But for sure read this paper from Creator of C++: https://www.stroustrup.com/new_learning.pdf
Anonymous
C++ builds on C, C# is closer to Java
C# can be summarized as a night of passion between C++ and Java
HeyMilkshake - 🇵🇹
I'd say c# is just a Java clone...
Anonymous
If you chose C# as a starting language, you won't fully appreciate the benefits it brings. With C and C++ you can use the procedural part of the languages and delve into object oriented programming later. In a first language, you should prioritize the parts common to all languages (variables, loops, if, and so on). To fully appreciate C++ and C# you need to study. Generations of programmers started with C and those other languages by the way. So, chosing C# doesn't make you a lesser programmer. Where you end is far more important than where you start
Lion
Hii
Andrew
Hi
Lion
Mr Nobody
Anonymous
Hi guys.. Anybody with php reading materials..?
Andrew
There is php group
Diego
I'd say c# is just a Java clone...
It was inspired by it, but it's gotten so much better than Java imo
Anonymous
I suggest to start with c, then see classes
#stop_teaching_c_as_cpp_preamble
Anonymous
Why ?
Dude, the YouTube link
Anonymous
Anonymous
There is non
@en_it_chats
Anonymous
@en_it_chats
/warn offtoo
Anonymous
/warn offtoo
/warn abusing bot
Anonymous
Oh poor guy
Andrew
Sorry i clicked for accident
J
#include <iostream> using namespace std; void inputArray(int array1[5], int array2[5]); void maxArray(int array1[5], int array2[5], int arraym[5]); void PrintArray(int array[]); int main() { int a[5]; int b[5]; int m[5]; inputArray(a, b); maxArray(a, b, m); PrintArray(m); } void inputArray(int array1[5], int array2[5]) { int i; cout << "enter values for the first array: \n"; for (i = 0; i < 5; i++) cin >> array1[i]; cout << "enter values for the second array: \n"; for (i = 0; i < 5; i++) cin >> array2[i]; }; void maxArray(int array1[5], int array2[5], int arraym[5]) { int i; int max = 0; for (i = 0; i < 5; i++) { if (arraym1[i] > array2[2]) max = arraym[i]; } }; void PrintArray(int array[]) { cout << "the values of the array are: \n"; for (int i = 0; i < 5; i++) cout << array[i] << " "; }
#include <iostream> using namespace std; class manip_2_Arrays { private: //size of the two different arrays to manipulate and check for int arraySize1, arraySize2; public: //member function to input and check out two arrays void inputArrays(); }; void manip_2_Arrays::inputArrays() { int array1[arraySize1], array2[arraySize2]; //COMPUTE FOR THE FIRST ARRAY /*Output the numbers*/ cout<<"Enter your first array size: "; cin>>arraySize1; cout<<"Enter your first array numbers: "; for(int i=0; i<arraySize1; i++) cin>>array1[i]; cout<<"1st Array["<<arraySize1<<"]"<<endl; for(int i=0; i<arraySize1; i++) cout<<"["<<i<<"] = "<<array1[i]<<endl; /*Get the maximum number*/ int max1; max1=array1[0]; for(int i=0; i<arraySize1; i++) { if(max1<array1[i]) max1=array1[i]; } cout<<"Maximum number in first array: "<<max1<<endl; /*Get the minimum number*/ int min1; min1=array1[0]; for(int i=0; i<arraySize1; i++) { if(min1>array1[i]) min1=array1[i]; } cout<<"Minimum number in first array: "<<min1<<endl; //COMPUTE FOR THE SECOND ARRAY /*Output the numbers*/ cout<<"\nEnter your second array size: "; cin>>arraySize2; cout<<"Enter your second array numbers: "; for(int i=0; i<arraySize2; i++) cin>>array2[i]; cout<<"2nd Array["<<arraySize2<<"]"<<endl; for(int i=0; i<arraySize2; i++) cout<<"["<<i<<"] = "<<array2[i]<<endl; /*Get the maximum number*/ int max2; max2=array1[0]; for(int i=0; i<arraySize2; i++) { if(max2<array2[i]) max2=array2[i]; } cout<<"Maximum number in second array: "<<max2<<endl; /*Get the minimum number*/ int min2; min2=array1[0]; for(int i=0; i<arraySize2; i++) { if(min2>array2[i]) min2=array2[i]; } cout<<"Minimum number in second array: "<<min2<<endl; } int main() { manip_2_Arrays arr; arr.inputArrays(); }
J
#include <iostream> using namespace std; class manip_2_Arrays { private: //size of the two different arrays to manipulate and check for int arraySize1, arraySize2; public: //member function to input and check out two arrays void inputArrays(); }; void manip_2_Arrays::inputArrays() { int array1[arraySize1], array2[arraySize2]; //COMPUTE FOR THE FIRST ARRAY /*Output the numbers*/ cout<<"Enter your first array size: "; cin>>arraySize1; cout<<"Enter your first array numbers: "; for(int i=0; i<arraySize1; i++) cin>>array1[i]; cout<<"1st Array["<<arraySize1<<"]"<<endl; for(int i=0; i<arraySize1; i++) cout<<"["<<i<<"] = "<<array1[i]<<endl; /*Get the maximum number*/ int max1; max1=array1[0]; for(int i=0; i<arraySize1; i++) { if(max1<array1[i]) max1=array1[i]; } cout<<"Maximum number in first array: "<<max1<<endl; /*Get the minimum number*/ int min1; min1=array1[0]; for(int i=0; i<arraySize1; i++) { if(min1>array1[i]) min1=array1[i]; } cout<<"Minimum number in first array: "<<min1<<endl; //COMPUTE FOR THE SECOND ARRAY /*Output the numbers*/ cout<<"\nEnter your second array size: "; cin>>arraySize2; cout<<"Enter your second array numbers: "; for(int i=0; i<arraySize2; i++) cin>>array2[i]; cout<<"2nd Array["<<arraySize2<<"]"<<endl; for(int i=0; i<arraySize2; i++) cout<<"["<<i<<"] = "<<array2[i]<<endl; /*Get the maximum number*/ int max2; max2=array1[0]; for(int i=0; i<arraySize2; i++) { if(max2<array2[i]) max2=array2[i]; } cout<<"Maximum number in second array: "<<max2<<endl; /*Get the minimum number*/ int min2; min2=array1[0]; for(int i=0; i<arraySize2; i++) { if(min2>array2[i]) min2=array2[i]; } cout<<"Minimum number in second array: "<<min2<<endl; } int main() { manip_2_Arrays arr; arr.inputArrays(); }
Hi @Hosam_47 i read your code and also the problem it was trying to solve. Then I tried creating separate functions to be able to get what you wanted. But then it occurred to me that in doing so I am limiting myself to the c++ language. This is because a class can do it better be just executing it all. Well I also learnt a lot from your code. I just tried to do it the OOP way and send it to you so you can see. Thumbs up, would be waiting to hear from you.
Anonymous
http://www.luastudio.net/ crack?