because this community has clear rules, standards, and expectations of its members. if you can't follow them, then you will have a very hard time here.
Printable View
It is quite true that this topic was going nowhere. But that was because the OP was waiting for someone to fix the program for him. He appears to be unwilling to do the actual work himself but continues to cry and cry until someone takes pity on him and gives him a solution. His tactics seem to be working, congratulations.
Jim
It certainly is not. Had a description of the solution been given in english it would have been up to the OP to translate this into C++, which is a required skill if he hopes to ever become proficient in _any_ programming language. By providing the code straight up you have robbed him of the opportunity to practice this.Quote:
In my defence my "answer" is the same as if I'd given an English description, a mathematical description, a pseudocode description, or whatever.
Furthermore as Elysia has attempted to point out several times now, using dynamically allocated C-style arrays is not the proper way to solve this problem. Since OP has failed to explain why this is a requirement it is at this point fairly safe to assume that there is no good reason for this. By supplying this code to the OP you've made sure there is no immediate incentive for him to learn how to solve this using std::vector. Did you not just denounce schools teaching students to use old C-style mechanics when writing C++? Well you have now (inadvertently perhaps) done the same thing.
You could have worked with the OP on lower levels: ie, how to use vectors, how to add items, how to sort, whatever. Feeding a complete working example, working or not, is usually the wrong way.
Not to mention, what you gave was subpar C++ code. I'd go as far as call it C code, even.
There are two things we should strive for: teach newbies to be good programmers (ie, guide them to the answer; let them experiment, fail and learn) and teach them how to write high quality, safe, portable C++ code.
You failed on both accounts.
Let me clear up some stuff.Quote:
It's not inaccurate. They (Elysia) attacked me by saying my previous answers were non-constructive. They implied that I was saying the OPs code was crap (which I never did). I then added, what... 8?, lines plus a few comments to the OPs source code and then Elysia insulted the OP by saying their source code was complete and utter rubbish? Something doesn't add up here. I don't care if Elysia has 1 post or a million posts I'll be honest every time, even if the honesty seems brutal. Live with it.
I agree that the OP's code is garbage, but your previous replies didn't add anything of value.
Heard of constructive criticism? Yeah, we fail on this sometimes as we're not perfect, but try to learn from it. Feel free to criticize code, but try to also help in some way, like "X is garbage. But that's okay, you can do Y to fix it."
And yes, your additions to the code is also garbage, because not only did you use the OP's bad code, you also added more bad code to it. Not a very good thing to do. It would have been much better if you'd modified it to use safer and modern C++ idoms such as vectors in your examples.
Opinions are important and you should absolutely not "succumb" to someone else. It's good that you express your opinions, but at the same time, we like to get along.Quote:
To be honest I'm not overly impressed with "the regulars" and their conduct. Should I quiver in fear and follow like a lost lamb? Nah. Of course not. How new I am or how "old" they are is not relevant. If I think their example is wrong I'll say so and not just bow to their experience... that'd be a bit silly.
Edit: I do realise your post was written with the best of intentions and I thank you for that. But, please, do not suggest to me how I should conduct myself.
Generally, there is one thing that is frowned upon and that is spoon-feeding. If you spoon-feed people, members here will disagree with you, and that's never a good thing.
We want to get along with you. I don't care if you're a new member or an old member. It's all the same. You are as welcome to this board as anyone else. All we ask you to do is not spoon-feed people.
vectors are not lower level; they're higher level!
I studied vectors and now my same programm using them:
Code:// crcvectors.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
#include<conio.h>
#include<cctype>
#include<vector>
using namespace std;
int main()
{
int n,lim_fcs,lim_pattern,tot_size,len;
cout<<"\nEnter the length of message\n";
cin>>n;
vector<int>message(n);
vector<int>::iterator p;
cout<<"\nEnter the message\n";
for(p=message.begin();p!=message.end();p++)
{
cin>>*p;
}
cout<<"\nThe message is:\n";
for(int i=0;i<message.size();i++)
{
cout<<message.at(i);
cout<" ";
}
//storing here to retrieve it later for xor
vector<int>message1(n);
for(int i=0;i<message.size();i++)
{
message1.at(i)=message.at(i);
}
cout<<endl;
cout<<"Enter the Limit for fcs(frame check sequence)"<<endl;
cin>>lim_fcs;
cout<<endl;
cout<<"Enter the size for Pattern vector"<<endl;
cin>>lim_pattern;
vector<int>pattern(lim_pattern);
vector<int>::iterator q;
cout<<"Enter the Pattern"<<endl;
for(q=pattern.begin();q!=pattern.end();q++)
{
cin>>*q;
}
cout<<"The pattern you entered is:"<<endl;
for(int j=0;j<pattern.size();j++)
{
cout<<pattern.at(j);
cout<<" ";
}
cout<<endl;
tot_size=n+lim_fcs;
len=tot_size-n;
vector<int>a(len,(int)0);
//for(int j=0;j<len;j++)
//{
//cout<<a.at(j);
//cout<<" ";
//}
for(int j=0;j<len;j++)
{
message.push_back(a[j]);
}
cout<<"The new Message is :"<<endl;
for(int k=0;k<tot_size;k++)
{
cout<<message.at(k) ;
cout<<" ";
}
cout<<endl;
vector<int>result(tot_size);
for(int k=0;k<len;k++)
result.at(k)=message.at(k)^pattern.at(k);
cout<<"result is:"<<endl;
for(int k=0;k<len;k++)
cout<<result.at(k)<<"\t";
cout<<endl;
for(int k=0;k<len;k++)
message1.push_back(result.at(k));
cout<<"The message to send(at sender side is)"<<endl;// the message ready to be sent
for(int index=0;index<tot_size;index++)
{
cout<<message1.at(index);
cout<<" ";
}
cout<<endl;
getch();
return 0;
}
The OP has done it now using vectors...You have no right to say what you said..I don't care for guys like you who roams about in search of just cross posters..If SirPrattlepod did give me a very close hint one should not overreact over it...If you canna help others just stop and dont stop others from helping.
SirPrattlepod did gave you a hint, albeit a very, very wrong one, which is why everyone is reacting. We don't want you to solve the problem YOUR way. We want you to solve it using OUR way, because we know good from bad practice and we want you make you a GOOD programmer and not a bad one.
Your code has horrible indentation, however, so it's difficult to read. You should work on improving that.
Your code has horrible indentation, however, so it's difficult to read. You should work on improving that.[/QUOTE]
Actually what i posted earlier and many of you called it CRAP that's so painful for me.this is a forum comprising of programmers of various skills ...some maybe just developing others maybe professionals .calling one's code such slangs should be revived..that's not fair in simple words..you did tell me to use vectors instead that;s good idea i learnt them and used them but as before i posted code as i wrote it (raw form)..i was not presenting it rather sharing it as usual.this i does because earlier too i posted code as on its way to completion not fianlly ..that's why i didn't care for indentation
Indentation is nothing.
My solution is not "wrong". In fact, my contributions give more insight into what is happening than using vectors can ever hope to do.
Telling someone to solve a problem YOUR way instead of THEIR way is, well... have you heard of the word hubris?
Mate, just ignore them. I didn't call your code crap (although, honestly it could be improved a lot ;-)), Elysia did.Quote:
Actually what i posted earlier and many of you called it CRAP that's so painful for me.this is a forum comprising of programmers of various skills ...some maybe just developing others maybe professionals .calling one's code such slangs should be revived..that's not fair in simple words..you did tell me to use vectors instead that;s good idea i learnt them and used them but as before i posted code as i wrote it (raw form)..i was not presenting it rather sharing it as usual.this i does because earlier too i posted code as on its way to completion not fianlly ..that's why i didn't care for indentation
Elysia, please point out how my hint is "very, very wrong". Thanks.
Indentation is everything.
The solution is not wrong, but is certainly isn't good. It contains bad practice all over the place.
Hubris? No, but I googled it. But come, don't be silly. If newbies solved their problems their way, what would we end up with? We are the ones who know the language. We know what's good, we know what's bad, so what is wrong in guiding people to solving it our way? Our way simply can simply mean getting rid of bad practice. I think you are misunderstanding what I meant by it. By posting a solution, you did, in fact, solve it your way, in the way you think the OP should solve the problem. In this sense, we're the same. We guide the newbies to solving the problem by giving input, essentially making it so they do it the way we want.
After you just told someone to "ignore" me?Quote:
Mate, just ignore them. I didn't call your code crap (although, honestly it could be improved a lot ;-)), Elysia did.
I think you have to work on your manners. Even I have limits to my patience and I tend to treat people as innocent until proven guilty.