Coding (C++,C, etc..) and the Various Ways it Can Be Done

Discussion in 'Science, Technology, and Green Energy' started by LA, Jul 6, 2015.

  1. LA

    LA Well-Known Member

    Anyone here with a lot of experience in 'C' (C++ is too advanced for me right now. I only need C) coding? If so, are you able to write C code right now and how well can you do it?

    I'm currently studying a class which involves such information.

    At home I use an Apple iMac (2013 model) and Xcode is what's needed but in class we use Windows so Code::Blocks is what we use.
     
  2. archangel

    archangel Well-Known Member

    I'm interested to see who says yes. I mainly understand C++ and C isn't that far away since C just doesn't have strings and classes.
    I can help out if no one says yes. I uses eclipse. Just want to point out that you may be using different compilers or versions. I've seen this cause issues at my job. I'd probably stick to code::blocks so that everything runs smoothly. You can use winebottler to run code blocks if there is no mac version. probably not since Xcode is there.
     
  3. jaisee

    jaisee Well-Known Member

    I have experience in C.

    If you're taking a class, I'd highly recommend looking up CS50 for free online. It's Harvards Introduction to Computers course, where the first 7 or so weeks are just C programming.

    Go to edx.org and search for CS50.

    The most difficulty that most people find with C is the memory management that is not required by most other programming languages. Understanding how to reference and dereference pointers and the such.

    I do not profess to be an expert by any stretch, but I may be able to lend some assistance when needed. What types of code are you being asked to write at this point?

    Edit: I usually use VI for more basic stuff, but eclipse for larger projects.
     
    Last edited: Jul 6, 2015
  4. LA

    LA Well-Known Member

    Right now we've done things such as this:

    1.) Write a program that calculates the value of e, for values of 3,5,7, and 10.

    Print out each of these values in a separate line.


    2.) Write a program to compute the volume of a cylinder, of radius 12.5 and length 23.


    3.) Write a message through characters (at least 8 letters long)! Store the characters as numerical values, then display them through the program.


    4.) Prompt the user to enter a character, then print out that character, and the next 3 characters in sequence.

    Ex: The user enters 'A'

    The program prints out A, then B,C,D



    *Turn in one .c file per programming question, or both in one.
     
  5. LA

    LA Well-Known Member

    I had a hard time writing #3 and #4.

    I couldn't complete the assignment.
     
  6. nardolaflare

    nardolaflare New Member

    Damn, I wish I had seen this earlier. I'm a programmer that knows several programming languages, C and C++ included.
     
  7. Skylight

    Skylight Active Member

    I've programmed in C back in the day.

    For #3 I think they're asking to store a char array into an int array and then assign that back to a char array and the print the value.

    A string is just a sequence of characters terminated by a null character. (If you're taking a class, there must be some reference material you can check out. If not, check out this link for more details.)

    Anyways, I think you can assign a string array variable to an int array. What does that do? That stores each element of the char array in numeric values in the int array. What are the values of those array elements? Well, check out the ASCII character encoding table.

    Now you're almost done. You can assign that int array variable back to a char array variable and do a print on that string.

    #4 is asking you to scan one character from the command line, convert it to its ASCII value (stored in variable called 'j', then generate j+1, j+2, and j+3. Then transform those values into chars and then print them.

    Basically for #3 and #4, you're working with converting between one format and another.
     
  8. Skylight

    Skylight Active Member

    I think for your class, use whatever platform you have that's been checked off by your instructor.

    You can also check out REPL.IT.
     
  9. LA

    LA Well-Known Member

    I really appreciate the assistance with C programming. I'm no longer taking C programming at this point. It was just one class last summer but if I do end up coding again, I will refer back to this thread and bump it in hopes that you or someone else has useful information to share. :)
     
  10. Skylight

    Skylight Active Member

    No worries.

    Programming can be frustrating, but it gets easier with practice.

    By the way, a lot of fundamental software is written in C. For instance, macOS, the Linux kernel, and Windows, are all written in C. The C programming language is *the* cornerstone programming language in the software world. The basics are initially frustrating to get, but once mastered, it gets easier.

    Also, knowing C opens up a lot of cool job opportunities, and even allows you to learn other programming languages on the job.

    If you're just interested in learning a general-purpose programming language, and you have options, I suggest Python. There are cool things about Python.

    It's modern.

    It's simpler.

    It's quicker to just get going.

    And you don't have to worry about details as you would with C.
     
  11. Beasty

    Beasty Well-Known Member

    Any C programmers still around?
     
  12. archangel

    archangel Well-Known Member

    I am more of a cc++ programmer but I can take a look.....
     
  13. Beasty

    Beasty Well-Known Member

    hmm....... gonna try looping everything
     
  14. Beasty

    Beasty Well-Known Member

    Ok so I figured it out after a few attempts

    The algorithm counts all of the passing test grades and tells you when you enter an invalid or failing grade. It keeps going until you enter the "sentinel value" which is -1 in this case. After you enter the value it gives you the total number of passing grades.

    This is my last time taking an online class. This teacher only gives us the bare basics and we have to figure everything out for ourselves. Luckly, I happen to like the subject matter.

    I was going to post the code then I remember that the teacher could find it if it's on the web. I'm going to delete the other algorithm.

    Anyway, If there are more novice coders out there like myself you can hit me up in this thread if you ever need help. I'm getting sharper by the day.


    The previous algorithm that I posted a few days ago was something totally different.
     
    Last edited: Mar 18, 2017
  15. Beasty

    Beasty Well-Known Member

    Thanks. I deleted the code but I probably could use your help in the near future.
     
  16. LoversGrief

    LoversGrief New Member

    Anyone familiar with MIPS Assembly?
     
  17. Beasty

    Beasty Well-Known Member

    Nope. I'm working on problem solving with arrays right now. You're probably more advanced than me, could you elaborate or post examples?
     
  18. LoversGrief

    LoversGrief New Member

    MIPS Assembly is for microcontrollers, it's hardware-software interface language, it's very complicated (like any assembly language,) you wouldn't use it unless you absolutely need to.
    I worked a lot with MIPS language when I was doing electrical engineering.

    https://en.wikipedia.org/wiki/MIPS_instruction_set
     
  19. Beasty

    Beasty Well-Known Member

    I'm more of a hardware guy so I can appreciate the intimacy that lower level languages likely allow you to have with the processor, but I imagine them being brutal to work with.
     
  20. Beasty

    Beasty Well-Known Member

    My knowledge of digital circuits is helping me now. The applied logic has parallels. Aced my test last night.
     

Share This Page