Thread: Question, Im very new

1. Question, Im very new

Alright, I am planning on writing a program to encrypt text using the Caesar cipher. To do this I was planning on isolating each character and then performing the operations to encrypt on that character. However I do not know how to isolate that character from the inputed text.
How would I do that?
Is there a better way?

2. I am sorry, but I have never done any real programming. I know HTML and Basic pretty well. But that dose not compare to C.

3. You need to learn how to walk before you run. Get a decent text on the C programming language, learn it, and then try your program. As for a text, since you have done some programming, I think The C Programming Language Second Edition, by Brian Kernighan & Dennis Ritchie might be good for you. It is pretty much the standard for C programming texts.

4. Originally Posted by Penguinlord
Alright, I am planning on writing a program to encrypt text using the Caesar cipher. To do this I was planning on isolating each character and then performing the operations to encrypt on that character. However I do not know how to isolate that character from the inputed text.
How would I do that?
Is there a better way?
There is no better way - the algorithm for an efficient Caesar cipher, is the same, in any language.

in C, there are no strings - almost. Each char is already separated from the others, so instead of this, in BASIC:

Code:
```FOR i = 1 TO LEN(string\$) STEP 1
mychar\$ = MID\$(string\$, i, 1)
NEXT i

C does this:
char string[] = {"Once a jolly swagman"}; //compiler will count the spaces needed

for(i = 0; i <= strlen(string); i++)  //you should #include <string.h> when using strlen()
mychar = string[i];                      //the name of the array is it's base address in C

//curly braces are optional if the parent expression has just one child
//expression:

length = strlen(string);    //this is more efficient than re-calculating
for(i = 0; i <= length; i++) {  //strlen(string) within the for loop
mychar = string[i];
}```
Enjoy C, and welcome to the forum.

5. You need to learn how to walk before you run.
sometimes you need to run to learn how to walk

6. Originally Posted by datainjector
sometimes you need to run to learn how to walk
Err... no!
If you were looking for an analogy to support that idea I would have used: "Sometimes you have to be thrown out of the nest to learn how to fly."

But no, being thrown in the deep end in programming is seldom a good idea.

7. Originally Posted by iMalc
Err... no!
If you were looking for an analogy to support that idea I would have used: "Sometimes you have to be thrown out of the nest to learn how to fly."

But no, being thrown in the deep end in programming is seldom a good idea.
And yet you'd think, with all the students coming in saying "Our teacher just gave this linked list assignment and doesn't teach us anything...so what's a loop?" it happens all the time.

8. As a former lifeguard and water safety instructor, I can tell you, it's not the way to learn to swim, either.

Popular pages Recent additions