That actually worked. Let me see if I can adjust my actual program. Thank you.
Type: Posts; User: rculley1970
That actually worked. Let me see if I can adjust my actual program. Thank you.
I am having problems with something that should be simple. Just trying to initialize a member variable and then use a friend function to display the private member variable. As you can see, I pass...
I appreciate everyones help, I just got on and am looking at the help and working on it now. I don't want to go too far into explaining since it is for a class so I just want hints provided as I...
Unfortunately I cannot have any variables or arrays declared in the main() function. The only thing I can use in main are the function calls. I also don't understand how arr[5] can be declared for...
I am putting the funtions before main(), only the function calls are being put into main(). I get the error:
error C2109: subscript requires array or pointer type
for my array in the second...
int array (int size, int i)
{
int a[5];
printf(" enter the 5 elements for the array.\n");
for (i = 0; i <= 4; i++)
{
scanf("%d ", &a[i]);
}
printf("%d, %d, %d, %d, %d\n", a[0], a[1],...
I am trying to create a program with multiple functions before the main function. I am trying to use an array and use the element data in all the different functions but I am getting an error saying...
Thank you for everyones help. I finally figured out all the bugs and got it working just right. And just in time.
Is there something I am missing? I can't seem to find the issue.
float count, num, sum, average;
int n, op;
printf("please enter your numbers: \n");
do {
FINALLY figured it out. but it sorta messed up some other function within the program. I was able to put things into a do-while loop with 'getchar'. still working on it. Didn't have to use...
that code only displays the number you type in. if you type in a letter, it will only show 0.00 and end the program. If you look at the original code I posted, you will see that it is an infinite...
That is quite advanced to what I should be using right now. As far as I was told by one instructer, I should be using the 'getchar' command. Isn't there are more simple way of doing this?
This program is for a class so I do not want the exact answer. I would greatly appreciate a nudge in the right direction though. I have tried to put the "getchar" command in but had no success. ...
I looked into this and understand that it is the getchar command. But I have tried several ways of doing it but cannot seem to get it to work right. I have a program that is supposed to accept...
Is it possible to create a do-while loop to restrict input to numbers only and not letters?
Thank you CWR, the hint helped and i figured it out. here is the code:
#include <stdio.h>
main()
{
float n, average = 0, count = 0, sum = 0.0;
printf("This program averages grades.\n");...
thank you, let me work on it.
Here is the code that i came up with to input some numbers and then try to average them. The only problem i really have right now is how to count the loops so i can divide it as an average.
...
I am trying to figure out how to count loops to do an average of numbers input. It is a lab for a college class so I will accept only hints if neccessary. I can use a "while" statement to accept...