Develop a program to meet the following requirements:

  1. Must use at least two functions, not including Main

  2. Must use indirection (the * operator)

  3. Must use a loop

  4. Must use an array to hold the integers

  5. Must take the integer inputs from a file

Your assignment is to take ten integers as input from a file, store them in an array and then:

  1. output the largest

  2. calculate the average value of all ten integers, output as float

  3. output the contents of your array of integers in order, first to last

Use the following integers:

318 34 18 87 472 809 70 33 51 719

Im having problems with creating a file and then storing them in an array. Really cant do much until ive got that part.

We will help those who make a sincere effort to do the work. We aren't here to do your homework for you... Given that major companies pay me $200USD / hour to write software for them, why should I help you cheat on your school work? :-(

you dont have to write code for me.. I was just hoping someone could explain how I create a file and then store it into an array. Ive googled it but its really confusing

Get your terms straight.

You don't "create the file" to store it in an array. You open and read an existing file to store it in an array.

So in detail (excruciating detail) explain the first part of the program you need help with, and show us what you've tried.

Is this homework? [edit]Doh -- read the title, fool![/edit]

Edited 4 Years Ago by WaltP

Must use at least two functions, not including Main

For this, you have to use macros. you'll have to define two functions which indirectly point at main(). You will not see main() written anywhere in the program but it actually gives a logical call to main(). Give it a try use ## macro.

For this, you have to use macros. you'll have to define two functions which indirectly point at main(). You will not see main() written anywhere in the program but it actually gives a logical call to main(). Give it a try use ## macro.

What the heck are you talking about???

Macros? Why?
Point to main()? What's that mean?

Why would you not see "main() written anywhere in the program"? That's not how a student learns to program.

Edited 4 Years Ago by WaltP

@waltP

here it is.. you use two functions (vishal and sharma), not including the main().

#include<stdio.h>
#define sharma(s,t,u,m,p,e,d)  m##s##u##t
#define vishal sharma(a,n,i,m,a,t,e)
int vishal()
 {
  printf("hii");
  return 0;
 } 

this is the way to do it, if this is the question he asked for

Edited 4 Years Ago by Vish0203

It isn't. Your suggestion is worthless and will only confuse the OP since nothing you mentioned was even asked for. Instructors don't teach tricks in beginning courses.

Edited 4 Years Ago by WaltP

Comments
experince!! :-)

fine.. his question said "not including main" thats why I gave this suggestion. By the way i know you are very experienced, but i don't understand why you start yelling after my every post!
fine you guys carry on. I'm out of it!

Must use at least two functions, not including Main

means you must have to functions in addition to main(). Yes, this comes from the experience of reading bad instructions from instructors who aren't clear.

i don't understand why you start yelling after my every post!

I'm not yelling at you. I'm correcting the misinformation you keep posting so the OP gets good information.

All you need to do is to read the question more carefully, and explain your response better.

All you need to do is to read the question more carefully, and explain your response better.

okay!! i'll do the same.

This article has been dead for over six months. Start a new discussion instead.