does the age of any arbitrary C "teach yourself to program" text books matter? Has the language evolved since say 1988? I've been teaching myself for a few months and am ready to take it to the...
Type: Posts; User: Andersonsacanno
does the age of any arbitrary C "teach yourself to program" text books matter? Has the language evolved since say 1988? I've been teaching myself for a few months and am ready to take it to the...
Thank you so much!
Thank you...now what happens in this situation..
take 5 for example..
5 == 00000101 in binary
if you perform 5>>1, it becomes 00000010
How can bitwise operators be used in encryptions...
Yes, I just get lost pretty quickly. From my understanding were shifting binary number places around? So basically I have get an understanding of the numbers I am using in binary form before this...
Hello, I am currently a beginner in both programming and cryptography. I have written a few real basic encryptions that just use simple math and from what it seems I need to get a grasp on bitwise...
#include <stdio.h>
#include <conio.h>
#include <string.h>
void append(char* start, char temp)
{
int len = strlen(start);
start[len] = temp;
start[len+1] = '\0';
}
int main()
My friend and I have been able to read the numbers from the file, change them from ascii (char) into ints, then sort them using the same functions I used my original sort and fprintf to a file. I...
Thank you.
Next up: Reading numbers from file
fwrite sucks < fprintf rocks
#include <stdio.h>
#include <conio.h>
void swap (int *a, int *b)
{
Solved:
Something had to have been incorrect with my permissions on C: drive.
Tried switching to a desktop file which still returned failure.
This is the correct way to write code to files...
Strange occurence when working with file input output:
Here is my code.
#include <stdio.h>
int main()
{
FILE *fp;
fp=fopen("c:\\test.txt", "wb");
Judging from what you've said and the fwrite source I tried these:
FILE *fp;
fp=fopen("c:\\test.txt", "w");
fwrite(a, sizeof(100), 100, fp);
fclose (fp);
#include <stdio.h>
#include <conio.h>
void swap (int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
Aha! Back in business!
So i was telling it to sort the locations not the values?
Thank for your code adak, however it only runs what I depict as a printing a ton of ram locations; I am having the same problem.
#include <stdio.h>
#include <conio.h>
void swap (int...
I guess this is more or less a bubble sort that moves int's backwards..i realize its not a selection sort, why its not a selection sort, and have learned a lot so its a success, now I will be trying...
sorry to keep posting it up but I understand now! (Programming is so awesome)
Nevermind, I have been playing with it and changed the inner loop to go other way..
for (j=i; j >= 0; j--)
It works guys!
What i don't understand is why this works. I can't visually...
:D
Last night while you were helping me my code was working (i realize this isn't a selection sort but it's not really a big deal)
here is the output
Spots in array:
5
Wow guys thanks for all the help!
#include <stdio.h>
#include <conio.h>
void swap (int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
I'm sorry std10093 I'm lost with that statement. I have no idea how to iterate what you are asking me. Why would j have a value of x-1?
My mistake on the second expression of the for loop :o need to be more careful obviously..
for (i = 0; i < x; i++) //quits when i is larger than x
{
for(j=i; j < x; i--) // isn't...
wouldn't using j = i in the second loop allow the data in my sort function to pass through the original for loop after each pass? Is this what you are refering too?
Hello i have recently started programming in C and have managed to put together my first selection sort program.
#include <stdio.h>
#include <conio.h>
int sort(int a[], int x)
{
int i,...