Hey, I have a homework question that I've tried to complete but I hit a wall. The objective is to have a user input some numbers so that the program can output two columns, one showing each unique number that the user inputted, and the other showing how many times the user inputted said number.
example.(I don't know the formatting of this thread)
Input: 1 5 3 5 5 12 3
Unique # frequency
1 1
5 3
3 2
12 1
I have no idea on how to approach this. I'm super beginner at C and all i've managed to come up with is:
Code:
#include <stdio.h>
#define list 50
#define value 50
int check (int x,int num,int amt);
int main(){
int x[value],num,i,j,k,amt;
printf("Enter the amount of numbers:");
scanf("%d",&amt);
for (i=1;i<=amt;i=i+1){
printf("Enter Number[%d]: ",i);
scanf("%d",&num,&x[i]);
check(x,num,amt);
return 0;
}
int check (int x,int num){
int j,k,y
[list]
for (j=1;j<amt;j=j+1){
if(x[j]=num)
As much as I'd like someone to do the whole thing for me, that's not gonna happen. I would like some advice as to whether i'm on the right track. I think if I use some crazy continue statements, I might be able to do it, but I've hit a wall. If someone would be so kind as to offer suggestions on routes I can take, I'd greatly appreciate it (Although it might be a long shot since I pretty much have nothing so far). Thanks for your time!