01-03-2007, 08:34
|
|
|
חבר מתאריך: 18.01.07
הודעות: 11
|
|
שלום שאלה איך? בשפת C
אני כתבתי תוכנית ומאחר שהתחלתי ללמוד מצביעים נאמר לכתוב את אותה תוכנית בעזרת מצביעים השאלה איך אני הופך את זה למצביעים . . .
תודה מראש!!!
#include"stdafx.h"
#include"stdio.h"
//Training with pointers
void main()
{
int arr[5];
int i=0,j=0,avg=0,temp=0;
//The input of numbers in loop and adding it into "temp"...
for(i=0;i<5;i++)
{
printf("Enter number:");
scanf("%d",&arr[i]);
temp += arr[i];
}
for(j=0;j<5;j++)//The loop that counts average...
{
avg = temp/i;
}
//The loop that prints the output of the numbers that are bigger than "average" & the "average!"...
for(i=0;i<5;i++)
if(avg < arr[i])
{
printf("The numbers that are bigger than average!: %d\n",arr[i]);
}
printf("The average of numbers:%3f\n",(float)avg);
}
|