I see, so "atol" doesn't get a single character.
yes, i was trying to get around "char to int" conversion error, and you brought up "atol" so i tried out and got the error above.
Thanks!!
Type: Posts; User: azsquall
I see, so "atol" doesn't get a single character.
yes, i was trying to get around "char to int" conversion error, and you brought up "atol" so i tried out and got the error above.
Thanks!!
based on my main()
int main(int arc, char *arv[])
arv[] is char pointer. I'd like to passed something like
command.exe 5 filename.txt
yeah. I tried that but the compiler won't let me
atol: cannot convert parameter 1 from char` to `const car`
thanks!
actually, i ran into problem
char* argv[]
that is an array of characters. yet, i need to get com port and baud rate, which has been declared as INT16. Is there any way to get around...
nice!!!
thanks!! I solved the problem!
Hi,
I have a c++ program that handles serial communications. At this stage, serial settings (ports, baud rate, settings) are hard-coded into the program.
I'd like to re-build the program so that...
hi guys
my bad...how come i didn't see that... ;)
it's working..it's my printArray function that prints out out-of-bound element...
thanks again!!!
1+rand()%6 should give out number from 1 to 6 right?
in my case, i got all weird number like -123655390
Ahh! I see. I totally forgot about that..
row=col=6 .. it's a 6x6 array and i tried to generate random number from 1 to 6 with 1 + rand() %6
i though the nested for-loop will loop through each element?
I had tried that, but the output elements still remains the same.
It should be different for each of the element; however, in this case, they're the same.
am I missing anything?
thanks!
Hi,
I've been trying to fill an 6x6 array with random number from 1 to 6,
this is my function that takes care of this
void initArray(int arrayName[][col], int row, int col)
{
for (int i...
You see the output?
How can I output the array's elements. Each element should be only read ONCE?
That's why I need the "check neighbor" function so that will ignore the repeated elements and...
The reason i do the sort because I want to generate the ouput like this:
INPUT: 5 5 5 4 3 2 8 9 3
number count
2 2
3 2
4 1
5 ...
I used bubble sort as it's the only I know so far.
I counted frequency of elements of 1 array by using another array for counter.
is there any way different than that?
:)
that's why I have to sort the input array first.
say you input: 3 1 3 35 4 5 3 34
after sorting: 1 3 3 3 4 5 34 35
Then I have do the check neighbor correct?
Is there any way smarter than...
Thanks!! I had tried that.
But it has 1 fall back.
countingArraySize=20
sourceArraySize=20
and if, somehow, we randomly input 4 5 4 3 2 32
then countingArray[ sourceArray[i] ]++ will be...
sorry for the confusing!!
the problem is to read a set of positive integer and output how many time a particular number appears. Assume that the maximum you can enter is 100 numbers.
For example...
hi guys
I'm working of self-study project that needs to count how many an element of an array is repeated. And print out result.
I've been asking myself whether there is a smarter way doing this....
thanks!!!
can you please abit more specific?
thanks!
i'd like to have the out to be
1
2
3
4
5
6
7
......
hi,
i have quite big program, with respect to my beginning skill, that contains a while loop. This loop, or the program itself, can only be terminated by pressing Ctrl-C.
I'd like to change that...
I got the same result
H T T T T H H H H
T T T H H H H H H
......
and the same count for each H and T for every execution...
perhaps, I should use "srand"
hi,
Just a quick question. I wrote a short code for generating 0, 1 randomly in order to simulate a coin-tossing game.
//This program will simulate 100 times
//of coin-tossings. Then it will...
hey thanks!!
I got it now!