Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

What topic is "conditional structures" under?

  1. Jun 14, 2014 #1
    So i have a book that covers the fundamentals one needs to know before starting C++. I'm self teaching myself so i don't have to take the intro programming class at school. Anyways, our professor sent us all a email that among a few other other topics (such as arrays and functions and loops), we must know how what "conditional structures" are and how to use them. However, unlike the other stuff he wants us to know, "conditional structures" doesn't have its own chapter in the book i"m reading. These are the chapters that my book has:

    1). introduction to computers, programs, and C++ (100 percent sure it's not in this chapter)

    2). primitive data types and operations

    3). selection statements

    4). loops

    5). functions

    6). arrays

    7). points and c-strings

    8). recursion


    From which of the chapters listed above would I be most likely to learn about "conditional structures"?
     
  2. jcsd
  3. Jun 14, 2014 #2

    Borg

    User Avatar
    Gold Member

    Conditional structures are things like if-else and loops. The chapters that you're looking for above are 3 & 4. Recursion would also fall under this but you don't want to read that first. You need to really understand conditional statements before you tackle recursion.
     
  4. Jun 14, 2014 #3
    Thank you very much for your response! Also, under which of the following topics (loops, functions, arrays, conditional structures) would "points and c-strings" fall under?
     
  5. Jun 14, 2014 #4

    Borg

    User Avatar
    Gold Member

    It's been a long time since I've programmed C++. The title "points and c-strings" sounds like it's talking about Pointers which wouldn't be directly related to those topics.
     
  6. Jun 14, 2014 #5

    jtbell

    User Avatar

    Staff: Mentor

    Yes, it's surely pointers and C-strings.

    They go together because C-style strings ("C-strings") are represented using character arrays that are usually referred to via pointers. Therefore C students, and often C++ students, are forced to learn about pointers early on so they can use strings.

    C++ has its own 'string' data type that doesn't involve using pointers, and many C++ programmers including me prefer to use it instead of C-strings. C++ strings are easier to use, precisely because they don't involve pointers. We use C-strings only when we're forced to, e.g. when using an API function that requires them. IMO a good C++ course should teach C++ strings first, and introduce C-strings later as a "C compatibility" topic.

    Nevertheless, some C++ books and courses still teach C-strings first, IMO basically out of historical inertia. The 'string' data type was added to C++ (over 15 years ago!) after the language had been in use for several years, so early C++ textbooks used only C-strings. Later editions often added the newfangled strings and other new features like vectors by tacking on a chapter at the end. Also, many people come to C++ from a background of C programming, and tend to think of C-strings before C++ strings.
     
    Last edited: Jun 14, 2014
  7. Jun 17, 2014 #6
    Oh. Thank you! that is very informative and helpful. So to clarify, it wouldn't be necessary to learn how to use "pointers and C-strings " before taking "Object-Oriented Programming Using C++" class?
     
  8. Jun 17, 2014 #7

    AlephZero

    User Avatar
    Science Advisor
    Homework Helper

    If it is a good course on OOP using C++, it would probably be better not to know about them (particular about pointers), otherwise you would have to unlearn the "wrong" way to do some things. (But there are bad courses and books on C++ which were "upgraded" from courses and book on C with the minimum amount of effort!)

    Those things are part of C++ because it was designed to be backwards-compatible with C. Some other object-oriented languages don't have any explicit concept of a "pointer" at all.

    On the other hand "C strings and pointers" are more or less inseparable from each other, and you can't do anything much that involves text in C (for example reading and writing data to files) without pointers.
     
  9. Jun 17, 2014 #8

    jtbell

    User Avatar

    Staff: Mentor

    It appears from this that your school's intro programming class doesn't use C++. What language does it use?

    As for pointers and C-strings, if your professor didn't say anything about them explicitly, I wouldn't worry about them. Maybe ask him about this if you want to make sure.
     
  10. Jun 18, 2014 #9
    The brief description of the intro programming class says that the prof may choose any programming language. I emailed the professor and he said " Please REFRAIN from sending me other questions about C++.

    Please DO NOT send me questions about C++ for now.

    Please save up your questions and ask when we meet in August 2014.

    And, this is the third informational reminder regarding "CIS 25 -- C++ Programming" class in the fall 2014 semester at Laney College.

    To take my CIS 25, it is strongly recommended that you have the following (real) programming knowledge and practices (or, perhaps taking my CIS 6 class prior to my CIS 25):


    0. Knowing programming styles and convention
    1. Knowing what conditional structures are and how to use them
    2. Knowing what loops are and how to use them
    3. Knowing what FUNCTIONs are and HOW TO use them
    4. Knowing FUNCTIONs really well and HOW TO use them
    5. Knowing FUNCTIONs really WELL and HOW TO use them WELL
    6. Knowing what arrays are and how to use them
    7. Knowing arrays well and how to use them
    8. Knowing arrays WELL and how to use them WELL
    9. Feeling comfortable with learning about memory and memory
    structures in programming -- You will be learning about this
    concept and more

    You can check out any recent C++ book(s) for information (any C++ books that are about 2011 or newer) -- Either online browsing or some book stores. I would advise you to look/browse/read and feel real comfortable with the book or books before considering the purchase -- Or you can wait until the class meeting in August.

    Please take the advice and think carefully before taking CIS 25.

    As for what else to be presented and learned in my class, you will be learning:

    a. Polymorphism
    b. Pointer and dynamic space
    c. Classes
    d. Inheritance
    e. Template
    f. Interesting applications coming from all above topics

    And please do not reply to this message."
     
  11. Jun 19, 2014 #10
    You should really take the intro course to programming if you have no experience and are trying to catch up to take his course. If this were the late 90's into the early 2000's, you'd be able to without issues, but programming has advanced quite a bit since those days. The intro courses are designed for exactly that - an introduction with the basic concepts and such. If you don't understand any of what is in that list, don't try to rush your learning as you'll get confused and struggle to even stay "a little far behind".

    Definitely keep on doing what you're doing with the self learning until you get into the intro class, so that will help you for sure, but to skip the introductory courses in anything, it usually requires a year or so of real world experience and/or 2+ years of experience and knowledge (experience from practice and writing beginner to intermediate level applications).

    Just my $0.02 :)
     
  12. Jun 20, 2014 #11

    that's a good point. thanks
     
  13. Jun 20, 2014 #12
    Jtbell, another question I have is that the book I'm self teaching myself off of was published in 2007. Do you think the fundamentals of programming have changed enough from then that I should get a newer edition of the book? How old is too old?
     
  14. Jun 20, 2014 #13

    jtbell

    User Avatar

    Staff: Mentor

    I've now looked at the actual course listings at

    http://www.laney.edu/wp/cis/computer-information-systems-courses/

    CIS 25 (Object-Oriented Programming Using C++) definitely looks like it assumes the student is already fairly competent in traditional procedural programming, in something like C, the non-object-oriented subset of C++, Visual Basic, Python, or whatever.

    Which language does your book use (the one that you're self-teaching out of)? And which book is it? If it's from 2007 it's probably out of print by now, but I might recognize the title or author(s).

    So long as it actually has you designing and writing programs, and running them (or trying to :wink:), and debugging them to get them to actually work; and gets you comfortable with the basic programming structures (if-statements and loops), functions (subprograms) and arrays of data, it should work, in principle. However, you should expect to put in at least as much effort as it would take you to do well in either CIS 6 or 25.

    I haven't taught that level of material since about 2005, but I seriously doubt that it's changed significantly since then. Things are always changing in the programming world, but the fundamentals at that level haven't, as far as I know. The material that your instructor is talking about is stuff that all programmers use. I was using that stuff in Fortran in the 1970s and 1980s, in Pascal in the 1980s and 1990s, and in C++ and Perl in the 1990s and 2000s.

    The course that I taught was a 2-semester intro to programming that used C++. The first semester covered basic non-object-oriented stuff. The second semester was mostly the stuff that's in your CIS 25.
     
    Last edited: Jun 20, 2014
  15. Jun 23, 2014 #14
    Wow! Thanks for taking the effort and time to look up the class at my school! :D


    The book I'm using to self-teach off of is by Y.Daniel Liang. This is the 3rd edition of the book (i'm using the first edition version) https://www.amazon.com/Introduction...8&qid=1403548410&sr=8-3&keywords=daniel+liang
     
    Last edited by a moderator: May 6, 2017
  16. Jun 23, 2014 #15

    jtbell

    User Avatar

    Staff: Mentor

    A Google search led me to info about the book on the author's web site:

    http://www.cs.armstrong.edu/liang/cpp3e/toc.html

    and on the publisher's web site:

    http://www.pearsonhighered.com/educ...tion-to-Programming-with-C/9780133252811.page

    It looks like Part I covers the material you need. And it does C++ style strings before C-strings. :thumbs:

    Be sure to do lots of programming exercises! Programming is a skill, and skills can be developed only by practice. You need to get to the point where the basic mechanics of writing and running programs (in whatever programming software you're using) come naturally and you can focus on the details of the programs themselves.
     
  17. Jun 24, 2014 #16

    jtbell

    User Avatar

    Staff: Mentor

    Oops, I forgot you're using the first edition:

    http://www.pearsonhighered.com/educator/academic/product/0,,0132320495,00%2ben-USS_01DBC.html [Broken]

    http://www.cs.armstrong.edu/liang/cpp/c++instructor.html

    It doesn't look like it uses C++ style strings, only C-strings, except maybe later in Part II.
     
    Last edited by a moderator: May 6, 2017
  18. Jun 28, 2014 #17
    thank you very much, jtbell! :biggrin:
     
    Last edited by a moderator: May 6, 2017
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook