homework help
I need help on my last assignment for my programming class. I have all the logic, I just forgot how to use -1 to end a string. and I need to put it in a function. I'm supposed to get a string of numbers from 1-9 and output a histogram. so say you enter 1 2 3 7 5 4 2 1 1 the program should output:
1: ***
2: **
3: *
4: *
5: *
6:
7: *
8:
9:
it's due tonight by midnight.
1: ***
2: **
3: *
4: *
5: *
6:
7: *
8:
9:
it's due tonight by midnight.
#include <stdio.h>
int main()
{
printf("Assignment 7 Track 1 CS 133 Stephani Diamond\n");
int a[10];
int i = 0;
int j = 0;
printf("Enter a string of numbers from 1-9. -1 to end\n");
scanf("%d", &a);
for(i = 0; i < 10; i++)
{
if(a[i] > 0)
{
for(j = 0; j < a[i]; j++);
}
}printf("*");
return 0;
}
