Jump to content


Photo
* * * * - 1 votes

c++ learning and comprehension


  • This topic is locked This topic is locked
80 replies to this topic

#61 livinded

livinded

    Dangerous free thinker

  • Agents of the Revolution
  • 1,942 posts
  • Location:~/

Posted 11 March 2007 - 10:07 AM

ok thank you very much and when i ran it i fixed the semicolon problem and i re read the code and this helps uber mucho thank you so much


Ironically, after you've finally convinced someone to give you an example of a function, it looks exactly like (surprise!) examples you might find in your 15 C++ books. I don't mean to drone on and on here, but you did exactly what I said you would. Someone finally answered your question that could have easily been answered by reading your books, and then you turn around and ask another such question. The argc and argv variables are covered in your 15 C++ books.


I think it's time to just give up on this thread. He is going to continue answering questions that are all answered well in at least one of his books. This are all very basic concepts of C++ (as well as other languages), just imagine when he gets into object...He claims to be 18, but I'm sure that at least one of his 15 books could explain at least this much of C++ to anyone who was able to read. They might not be a good programmer, but they could probably at least understand the topic being explained.

#62 Avatar/Oroborus

Avatar/Oroborus

    elite

  • Members
  • 109 posts
  • Location:san jose, CA

Posted 11 March 2007 - 10:26 AM

actually they aren't mentioned at all i just checked. and dude before me look at the topic learning and comprehension i don't understand something so i ask it in that bit of code i just gave i have no idea why they are there and have even googled it and i get nothing comprehensible to my question and what is a forum for other then to talk about the issues you have about one subject or another and im having problems with learning and comprehending c++ i don't need to be spoon fed just smoothed down around the edges about the basic of things im rereading teach yourself c++ 7th edition by al stevens right now and it does mention functions just not clearly there is no arguments in the example and when i put it into the compiler it i get errors

#63 Ohm

Ohm

    I could have written a book with all of these posts

  • Members
  • 3,209 posts
  • Gender:Male
  • Location:Maine, USA

Posted 11 March 2007 - 10:55 AM

I just don't know what to say. Al Stevens is a very good writer, many people here might know him from his "C Programming" column in Dr. Dobbs Journal. I'm looking at the table of contents of "Teach Yourself C++" and it seems very in-depth, this looks like an excellent C++ book for beginners. From Amazon's nifty search feature, it looks like argc and argv are covered on page 210. Now that we know you have a decent book (even though the other 14 may be less than decent), I don't understand why you keep coming back and asking questions. I doubt anyone here can describe this any better than the venerable Al Stevens. Chapter 3 is even devoted entirely to functions, how is some half-assed example code someone posting on the forums here helping you at all?

But what can I say? If this book doesn't click with you, try another one. You seem to have plenty of them. Sadly, I can't recommend a book for you. I learned C++ from "The C++ Programming Language" which, honestly, would frustrate you with the first chapter alone.

#64 Avatar/Oroborus

Avatar/Oroborus

    elite

  • Members
  • 109 posts
  • Location:san jose, CA

Posted 11 March 2007 - 12:22 PM

as you know, every c++ program has a main function. The main function has two parameters that you have not seen yet, because none of the programs have defined those parameters. All the programs so far have defined main with a empty parameter list. But main does indeed have two parameters. The two parameters are an int and a pointer to an array of char  pointers the int parameter contains the number of command line arguments that the user types on the command line to run the program. The char*[] argument points to an array of character pointers, which themselves point to the textual command-line arguments although you may name these  two parameters anything you like, the convention is to nmae them argc and argv and to declare then in the main function header <pre class='_prettyXprint _lang-auto _linenums:0'>int main()
{
//...
}</pre>the argc parameter always has a count of at least 1, and has a higher count if the user types arguments on the command line. There is always at least one char pointer in the array pointed to by argv, and it, argv[], points to the name of the program's executable file. if argc is greater then 1, the following argv parameters, argv[1], argv[2], and so on, point to the command-line arguments as they were entered on the command line arguments are separated by whitespace. If a command-line argument needs white space, the user surrounds the phrase with quote marks("), assuming your operating enviroment supports such command-line expansion. For example, consider the following command-line, which includes the program name that you type to run the program :pr13002 foo bar "foo bar"The parameters point to the following null-terminated strings as shown in table 13-1 { argv[0]  pr1301{ argv[1]  foo{ argv[2]  bar{ argv[3]  foo bar<pre class='_prettyXprint _lang-auto _linenums:0'>#include <iostream>
using namespace std;
int main()
{
   cout << "This program is " << argv[0] << endl;
for(int arg = 1; arg < argc; arg++)
	 cout << "Argument " << arg << ": " << argv[arg] << endl;
	return 0;
}</pre>this program displays the command-line arguments  on standard output by iterating the argv array through the element subscripted  by the argc parameter. if you enter the command lines shown above  and run the program from within the compiler. An application program interprets the meaning the meaning of command line arguments and modifies how the program works accordingly. command-line arguments can include program switch settings, modes, filename lists, path specifications, and so on.

ok so what argc does is store the number of arguments while argv stores the
characters in a pointer to arrays 0 being the name of the program its self i see
in the above program how to print the contents of of argv but later on it says that it
could be used for switch settings i know how it could store the path specifications and
lists but switch settings im lost and wouldn't some one have to be familiar with the
program to start with in order to put in the right arguments to pass to the program

READ: the above writtn code was taken from teach yourself c++ by al stevens
and released here by the gnu license agreement

Edited by Avatar/Oroborus, 11 March 2007 - 12:26 PM.


#65 Ohm

Ohm

    I could have written a book with all of these posts

  • Members
  • 3,209 posts
  • Gender:Male
  • Location:Maine, USA

Posted 11 March 2007 - 01:15 PM

Erm.. I don't think you quite understand the GPL. You can't just release someone else's work under the GPL. Has the author released this under the GPL?

And yeah, that's kind of the point. You need to read the docs before you can use the command-line switches.

#66 deadc0de

deadc0de

    SUP3R 31337 P1MP

  • Members
  • 272 posts
  • Location:ring0

Posted 11 March 2007 - 01:31 PM

Erm.. I don't think you quite understand the GPL. You can't just release someone else's work under the GPL. Has the author released this under the GPL?

And yeah, that's kind of the point. You need to read the docs before you can use the command-line switches.



GPL is a ugly, ugly beast.

#67 Avatar/Oroborus

Avatar/Oroborus

    elite

  • Members
  • 109 posts
  • Location:san jose, CA

Posted 11 March 2007 - 02:42 PM

ohm i just gave credit for the code to al stevens and said it was able for what ever you want and yeah i don't quite understand them either i just know that if you try to release anything under the gnu you have to realease everything

#68 intimidat0r

intimidat0r

    SUPR3M3 31337 Mack Daddy P1MP

  • Members
  • 455 posts

Posted 11 March 2007 - 03:27 PM

But you can't release other people's work under a license. The GPL is not a tool for plagiarizing or reproducing work illegally.

#69 Avatar/Oroborus

Avatar/Oroborus

    elite

  • Members
  • 109 posts
  • Location:san jose, CA

Posted 11 March 2007 - 04:10 PM

im not releasing work illegally its just like taking notes or coping a part of a statment it totally legal cause i boght the material and it is only for viewing im not releasing anything im using my property that was wrote by someone else to explain a difficult subject in a disscusion it would be totally gay to even talk about it cause i did it and would love to see anyone try to charge me for it i gave the arthur props on his work so im not saying it is mine so it is not plageirism and i did not break any copy written laws cause i did not produce the book in its entirety just a excerpt of it for a discussion

#70 relyt_123

relyt_123

    SCRiPT KiDDie

  • Members
  • 21 posts
  • Location:The Internet

Posted 11 March 2007 - 04:13 PM

Well if the author hasn't released his work under the GPL license, then you aren't releasing his work under the GPL license agreement... If he has, then it's my mistake.

#71 Avatar/Oroborus

Avatar/Oroborus

    elite

  • Members
  • 109 posts
  • Location:san jose, CA

Posted 11 March 2007 - 04:34 PM

im not releasing his work i took a part his work im not breaking anylaw cause i am not making any money from it as well as i did not reproduce the whole book it's like amazon takes pages out of the book and displays them do you think they ask every authur hey can we do this no its just a little bit , what i said about the license is that the code was released under the gpl and that the thing i wrote was written by al stevens and not me

#72 Avatar/Oroborus

Avatar/Oroborus

    elite

  • Members
  • 109 posts
  • Location:san jose, CA

Posted 11 March 2007 - 04:36 PM

its the same basis as peer to peer sharing i could copy the fuck out of the book and give it to anybody i wanted as long as i wasn't selling it to make money

#73 livinded

livinded

    Dangerous free thinker

  • Agents of the Revolution
  • 1,942 posts
  • Location:~/

Posted 11 March 2007 - 04:39 PM

You obviously don't know much about copyright laws, and yes, Amazon does get permission (as far as I know) to put up those chapter excerpts from a book.

Edited by livinded, 11 March 2007 - 04:40 PM.


#74 relyt_123

relyt_123

    SCRiPT KiDDie

  • Members
  • 21 posts
  • Location:The Internet

Posted 11 March 2007 - 04:55 PM

You obviously don't know much about copyright laws, and yes, Amazon does get permission (as far as I know) to put up those chapter excerpts from a book.


Yup. Actually on one old BRR episode, Stankdawg and his co-host we're talking about that. It believe it was either 18 or 19.

Edited by relyt_123, 11 March 2007 - 04:56 PM.


#75 Ohm

Ohm

    I could have written a book with all of these posts

  • Members
  • 3,209 posts
  • Gender:Male
  • Location:Maine, USA

Posted 11 March 2007 - 06:03 PM

its the same basis as peer to peer sharing i could copy the fuck out of the book and give it to anybody i wanted as long as i wasn't selling it to make money


Um.. but that is illegal. Copyright controls who has the right to copy a body of work. Making hundreds of copies and sending them to people over the internet is something you do not have the right to do. It doesn't matter if you're making a profit or not.

Edited by Ohm, 11 March 2007 - 06:07 PM.


#76 Avatar/Oroborus

Avatar/Oroborus

    elite

  • Members
  • 109 posts
  • Location:san jose, CA

Posted 11 March 2007 - 06:25 PM

study this i had to right a paper on copy right laws in 8th grade

Criminal offences

For the most part, the criminal law is only used for commercial copyright infringement with one exception, and an offence is committed when, knowing or reasonably suspecting that the files are illegal copies, and without the permission of the copyright owner, a person:

* makes unauthorised copies e.g. burning music files or films on to CD-Rs or DVD-Rs;
* distributes, sells or hires out unauthorised copies of CDs, VCDs and DVDs;
* on a larger scale, distributes unauthorised copies as a commercial enterprise on the internet;
* possesses unauthorised copies with a view to distributing, selling or hiring these to other people;
* while not dealing commercially, distributes unauthorised copies of software packages, books, music, games, and films on such a scale as to have a measurable impact on the copyright owner's business.
* publishing someone else's original copy work and claiming you have made it. (This is known as plagiarism and is completely different than copyright infringement, but laws concerning it come under the section of copyright law in some countries)

The penalties for these "copyright infringement" offences depend on the seriousness of the offences:

* before a magistrates' Court, the penalties for distributing unauthorised files are a maximum fine of £5,000 ($9,202) and/or six months imprisonment;
* in the Crown Court, the penalties for distributing unauthorised files are an unlimited fine and/or up to 10 years imprisonment.

Also note s24 Copyright and Related Rights Regulations 2003 which creates a range of offences relating to the distribution of any device, product or component which is primarily designed, produced, or adapted for the purpose of enabling or facilitating the circumvention of effective technological measures. When this is for non-commercial purposes, it requires there to be a measurable effect on the rights holder's business.


its legal cause im not within any of these categories because it was not a complete copy of the manuscript i might not have the authors permission but is of no measurable impact on the author and since i did not say i wrote it and explained that the code was free to copy and redistibute anyway you want im not plagiarizing anything im not distributing ot selling or hiring these to anyone i just wanted to draw to your attention what the book s said.

#77 relyt_123

relyt_123

    SCRiPT KiDDie

  • Members
  • 21 posts
  • Location:The Internet

Posted 11 March 2007 - 06:32 PM

The point is not that you aren't making money. It's the fact that he is losing money from potential buyers.

#78 rainwater_stillicide

rainwater_stillicide

    SUP3R 31337 P1MP

  • Agents of the Revolution
  • 282 posts
  • Location:Scotland

Posted 11 March 2007 - 06:33 PM

your profile says you're from san jose, california, but that is clearly british copyright law.

#79 Ohm

Ohm

    I could have written a book with all of these posts

  • Members
  • 3,209 posts
  • Gender:Male
  • Location:Maine, USA

Posted 11 March 2007 - 06:43 PM

your profile says you're from san jose, california, but that is clearly british copyright law.


Magistrate? Unauthorised? Looks like it is, or at least not US copyright law.. Oh, look where it comes from.

Spongebob crazypants, no one said you posting that snippet was illegal. I was only questioning why you were trying to put the GPL on it, then you had to go and mention the legality of peer to peer file sharing. But the fact that you did write that people have the right to use that snippet how they wanted is just crazy, you don't have the right to give that right.

#80 Avatar/Oroborus

Avatar/Oroborus

    elite

  • Members
  • 109 posts
  • Location:san jose, CA

Posted 11 March 2007 - 06:54 PM

ok im kinda getting irritated with this if you look back on it i said this was take from teach yourself c++ written by al stevens the code is released under the gnu license. Not anythign thing else just the stupid ass code that was put in there not anything else but the c++ source code




BinRev is hosted by the great people at Lunarpages!