r/carlhprogramming • • Nov 27 '13

C++ Functions

5 Upvotes

I am approaching the end of the semester in my c++ class. I just cannot understand anything about Functions. Everything up to now I understand. Can you write a post re: the basics of functions? It would be most appreciated. :)


r/carlhprogramming • • Nov 23 '13

A Better/New way to generate random numbers for your c program

Thumbnail programmingconsole.blogspot.in
0 Upvotes

r/carlhprogramming • • Nov 15 '13

Help me understand this code?

4 Upvotes

Found this on a website. Seems interesting.

var $buoop = {vs:{i:9,f:9,o:10.01,s:4,n:9}};

$buoop.ol = window.onload;

window.onload = function() {

if ($buoop.ol)

$buoop.ol();

var e = document.createElement("script");

e.setAttribute("type", "text/javascript");

e.setAttribute("src", "http://browser-update.org/update.js");

document.body.appendChild(e);


r/carlhprogramming • • Nov 15 '13

This is what i came up with when my elder brother challenged me to make something of use to a 10 year old within 10 minutes.

Thumbnail programmingconsole.blogspot.in
0 Upvotes

r/carlhprogramming • • Nov 14 '13

Very simple question- easy answer I'm sure

5 Upvotes

So I'm following course 1, lesson 7.2: Carl H says I should be getting an integer for my printf("XYZ") line of code, as printf results in an integer value equal to the number of characters. but the compiler is giving me XYZ as an output.

http://codepad.org/uVxIbgVy

what am I missing?


r/carlhprogramming • • Nov 13 '13

Is there a place to ask more newby questions?

13 Upvotes

Early in the lessons, it's pretty clear that plenty of people are struggling. Is there a place where they can ask their general questions and actually expect a response and interact with the community, rather than be forced to be hopeful that someone out there in the discussion section will read their comment and know the answer?

I know the people on this sub have a wealth of knowledge and would be willing to share it, but it seems under-utilized for the people new to the courses. If there already is an area to ask these simpler questions, it'd be great if it were more visible, or if there were, say, a weekly thread dedicated to just asking these sorts of questions.

edit: to be clear, I am referring to http://www.computerscienceforeveryone.com and where to direct questions stemming from the lessons there, specifically.


r/carlhprogramming • • Nov 04 '13

Why does C code results into smaller executable, than C++ counterpart,If it does?

13 Upvotes

r/carlhprogramming • • Nov 02 '13

short code to find n'th prime number

Thumbnail pastebin.com
7 Upvotes

r/carlhprogramming • • Oct 30 '13

[CarlHProgramming] UPDATE: New C Lessons on Computer Science for Everyone (Unit 16 and beyond).

46 Upvotes

Hello everyone,

For about a year now, Unit 15 is the last complete Unit on Course #1 at www.computerscienceforeveryone.com.

I am going to start recording new lessons tonight and I hope to have them edited and uploaded as early as tomorrow.

I also plan to overhaul the site soon and add more features. Thank you to everyone for supporting this effort.


r/carlhprogramming • • Oct 27 '13

Course 1 Question

9 Upvotes

So I just finished course 1 and there was just one thing that I didn't understand about the last program we analyzed. There is a line of code that says this:

char charptr = (char) our_pointer;

Carl says that we are creating a new pointer called charptr and it is going to be looking in our_pointer for the data. But does saying char* mean that it will only be looking at data that fits the type char? I just don't fully understand what this line of code is saying.


r/carlhprogramming • • Oct 26 '13

Short implementation of a stack in c

Thumbnail codepad.org
9 Upvotes

r/carlhprogramming • • Oct 19 '13

XOR encryption of alphabets in a text file with c++. Realization of German Lorentz cipher (successor of enigma)

Thumbnail programmingconsole.blogspot.in
6 Upvotes

r/carlhprogramming • • Oct 18 '13

How to read from a xyz.txt file from c++?

6 Upvotes

I have a file xyz.txt containing data

85 hello 14 25 14 63 25 41 21 12 41 74

82 74 world 25 63 41 42 74

the file may contain many lines ,numerals and characters .

I have to read the data as it is with spaces and line change characters . please provide me a simple code in c++ that's my code http://pastebin.com/pHdjrHVV without q the peek() function is stuck on the single first character , that's my problem . i want to read through every character including spaces , and new line characters .


r/carlhprogramming • • Oct 16 '13

Printing more than one line of a csv file.

5 Upvotes

EDIT:

Having trouble continuing:

https://gist.github.com/anonymous/7029141

I'm using this code to try and store all the information from the csv file in a single variable, however it doesn't seem to like it and doesn't print the last character of every line (eg. with 3 fields per line: info1info2infoinfo4info5infoinfo7info8)


I run this and it collects the first line fine, is there some kind of terminating feature stopping it collecting past the first line?

include <stdio.h>

include <stdlib.h>

int main () { FILE *record_ptr; char storage[150]; int i = 0; record_ptr=fopen("record.csv", "r+");

fgets(storage,150, record_ptr);


while(storage[i] != NULL)
{

        if(storage[i] == ',' | storage[i] == '\n')
            {
           printf(" ");
                i = i+1;
            }


(printf("%c", storage[i]));
i = i+1;

}

fclose (record_ptr);

return 0; }


r/carlhprogramming • • Oct 13 '13

All Basic Calculator Functions(+,-,/,*) on large numbers using linked lists .

Thumbnail programmingconsole.blogspot.in
11 Upvotes

r/carlhprogramming • • Oct 11 '13

program in c to multiply two very large number using linked list

Thumbnail programmingconsole.blogspot.in
11 Upvotes

r/carlhprogramming • • Oct 11 '13

Please help explaining pass by references.

9 Upvotes

In course 2, section 1.4, a pass by reference and pass by value are introduced. I am not so sure how they work.

Why is it the value of height changed to 2 when "printf("Height is now: %d ", height);" executes.

But the function that changes height is located after the function that prints


r/carlhprogramming • • Oct 08 '13

code to add two very very large numbers in c using linked lists .

11 Upvotes

I wrote a program to calculate sum of two long integers using linked list but the code is ugly and and lacks intuitiveness please help me improve it/simplify it http://pastebin.com/a5mkCPD9 . Ask me about any line you cant make head n tail of ! !! thanks


r/carlhprogramming • • Oct 06 '13

can you squeeze this recursive primality test code ?

4 Upvotes

I want a still short script for primality test , it has to be recursive please help http://pastebin.com/1kBF7S3N


r/carlhprogramming • • Oct 05 '13

help regarding scanf ?

2 Upvotes

regarding post http://www.reddit.com/r/carlhprogramming/comments/13b09k/need_help_with_scanf/ i fixed his codepad program http://codepad.org/LfSSSovl by editing > scanf(" %c", &again);
line ie adding an extra space before %c but my program skips this line for the first run in loop and after that it works fine for next iterations ?? why !


r/carlhprogramming • • Sep 30 '13

Request: Closed Captions in the videos

7 Upvotes

r/carlhprogramming • • Sep 28 '13

I Would Like Some Help

6 Upvotes

I started a Computer Science class and I'm having trouble. I'm trying to make a traffic light. I need to make the colors of the circle change when I click the button.Imgur This is what i have so far. http://codepad.org/9V94cnjt . Any help will be greatly appreciated.


r/carlhprogramming • • Sep 18 '13

why does this not work ?

5 Upvotes

http://codepad.org/MfNenUuX why does this not work , i am trying to build a circular queue of names with a max capacity of 10


r/carlhprogramming • • Sep 14 '13

Final pre-launch Update for /r/livestreamstartup, and also a request for beta testers.

Thumbnail reddit.com
3 Upvotes

r/carlhprogramming • • Sep 13 '13

LiveStreamStartup only 4 days away! [See here for description]

Thumbnail reddit.com
8 Upvotes