I'm a little late to this problem, but I would like to clear up a couple assumptions:
1) each line is one "serial number"
2) each serial number is 5 numbers separated by space
3) the order if...
Type: Posts; User: WaltP
I'm a little late to this problem, but I would like to clear up a couple assumptions:
1) each line is one "serial number"
2) each serial number is 5 numbers separated by space
3) the order if...
Jeez.
A-Z + 0-9 = 36 possibilities
string[i]=(rand()%36)+'0'; // get 0 to 35, add '0' to convert to number
if (string[i] > '9') string[i] +=7; // if above '9', convert to letter
Read in an integer
As stated above, use the modulus function to get the *last* digit
A simple WHILE loop will suffice, recursion overkill
So nobody bothered answering his question -- just arguing about a completely unrelated issue. Helpful.
Look into the functions defined in the ctime header, specifically time().
I disagree. If I run across a variable halfway down the page of code and it's not its first use, how do I know where its definition is? I have to search all through the code up to that point to find...
Where do you test for ESC?
What I would recommend is reading your binary value as characters (string). Then you can enter the entire binary value as discrete digits.
Then loop through that array until you hit the null at the...
For what you require, you don't need any sorting algorithm. you simply need to read each word in the sentence and compare it to your target word.
Look up the read functions (scanf, fgets, etc)....
Think about this section more critically:
counterb = 0;
if (decb % 2 != 0) {
counterb++;
} else {
counterb = 0;
}
You know you could make your loops simpler by using
for (i=499; i>=0; i--)
It would be easier to see what's happening.
Easiest way to debug something without using the debugger is to print...
Version 1:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define MAXSYM 20
#define OUTCOL 13
unsigned char symbols[MAXSYM] = { 128, 135, 143, 145, 156,
Yes. Much better -- because it's safer.
You'd be better off using the other technique mentioned above using the values from the ASCII chart and doing a simple math equation. You'd save yourself about 65 line and get rid of the switch....
And when you get to the next language that doesn't have an strtol-like function, you are a cripple. C is not the only language out there. and presumably is not the last one to be learned.
I've...
That's easily done by starting with a zeroed array and for each roll, using the total as an index to increment that value in the array
Is this an assignment requirement or your own? IMO, a...
Since /* ... */ are C-style comment, you should be using the C++ style // comments for your code.
Then when you want to comment out a section, the /* ... */ style will work much better.
Why? You don't learn anything about doing the conversions that way.
Why not? If it doesn't tell you why they don't compile, use something that will give you a list of errors. Like a real compiler.
But '2' = 50 and '7' = 55. Why wouldn't it be 105?
If '2' = 50, what do you have to do to actually make it 2?
That's not a bad way to go...
Look at this chart and you should be able to see how the math works.
Or you could simply close and open the file again after the first read is through.
Or my personal preference:
if (x >= 0)
{
x = x + 1;
}
else
{
if ( x >= 1)
Most (all?) forums give you a finite time to make changes. If you modify something after 6 replies, it makes all the replies look stupid.
So it's in plain text. That's what we expect. That's how...
I don't think size=sizeof(words)/sizeof(words[0]); is doing what you want.
When you add an entry, simply count it.
This count tells you exactly how many entries you have at all times. New entry,...
I got mine free with the download of 5.5.