Thanks, just had this on college today, I finally understand the purpose of pointers :)
Type: Posts; User: turke92
Thanks, just had this on college today, I finally understand the purpose of pointers :)
Thanks man, I see pointers again but would you mind explaining why face and suit have to be declared as pointers rather than normal variables? Thanks in advance!
Now I get what you mean by ASCII symbols, I'll keep that in mind for future programs.
Maybe the Fisher-Yates algorithm indeed is simple, but for my 3-4 weeks of C learning it's still a bit hard, but...
WOW that's more than I expected :O Thank you so much for such a detailed explanation.
1. I defined it bigger because somewhere in the code I went wrong and only king of clubs and king of spades...
I decided to do this out of curiosity and boredom...
Can anyone check it out and report if there are any bugs and/or problems? Just please don't tell me where I wen't wrong with my code, just...
I'm trying to find the DIGIT that appears most often... I'm sorry if I said otherwise!
EDIT:
I tried this and now it works perfectly! Thank you for your time! :D
In case you don't understand what I'm talking about here is an example:
79 95 77 64 89 72 39 83 26 99
7 -> the digit that appears the most isn't 7! It's 9...
Control print:
0 0 2 2 1 1 2 4 2 6
I'm using GNU compiler and it didn't report anything but I will include them... Thanks for the tips!
Have you found the problem?
Here is the whole code...
I don't get where I'm going wrong with indention... All the time I hear complaints but noone actually says where I went wrong...
#include <stdio.h>
#define MIN 1...
for (i=0;i<10;i++){ while(polje[i]>0) {
pom = polje[i] % 10;
znamenke[pom]++;
polje[i] /= 10;
}
}
max=0;
for (i=0;i<10;i++)
Thanks!
How can I find out which digit appears the most in the array?
Here is something I tried, but really messed something up...
#include <stdio.h>
#define MIN 1
#define MAX 99
#include <stdio.h>
int main(){
int N,min,max,i,j,temp;
printf ("Enter N.\n"); scanf ("%d",&N);
int polje[N];
My bad I forgot to translate "najmanji" and "najveci". "najmanji" is "first" and "najveci" is "third".
P.S. Sorry for double-posting but I can't edit the above post?
New problem!
The printout must be alphabetized but capital letters must be after the small ones if letters are same...
Example:
Input: B b z
Output: b B z
Example 2:
Input: A B z
look, it's not up to me what he wants us to learn...
we have tables but we need to know some basic values without checking tables!
he wants us to learn some ascii values...
solved. i can just input them into one 3-letter word... regarding the "magic" numbers... teachers orders...
another way: space before %c in scanf!
how can i fix it? :S while staying at the do while loop, i can do it with if's but i would like to do it with do while...
int i=0;
char a,b,c,pom;
do{
scanf ("%c",&pom);
if (pom<65 || (pom>90 && pom<97) || pom>122){
printf ("ERROR"); return 0;
}
if (i==0) a=pom;
if (i==1) b=pom;
Got it! Now I realize how stupid I was... Thanks XD i can't believe your tip actually helped :P
EDIT:
What if I want to alphabetize them and sort by capitals?
Example:
Input: b f B
I know hot to get it with a "couple" of ifs but there must be a simpler way i just cant seem to notice...
I can't find out which character has the middle ASCII value between the 3... I can solve the smallest and biggest but im having some issues with the middle one... pls help!
#include <stdio.h>
...
Like I said, I got it now, but didn't know this when I encountered the code on the 1st post.