救命! :( [英] help! :(
问题描述
我意外地删除了有人帮助我写的东西,我很唉如果我不解决这个问题就麻烦了。我真的需要帮助!!!!!
继承人我拥有的:
/ *
* /
#include< stdio.h>
#include< stdlib.h>
#define SIZE 12
void printResults(char months [] [ 15],双重销售[]);
void storeSales(char months [] [15],double sales []);
int main(void )
{
system(clear);
int i;
双倍销售[SIZE] ;
char months [SIZE] [15] = {" January"," February"," March"," April",
" May" ;,
June,July,August,September,October,
" November"," 12月"};
for(i = 0; i< SIZE; i ++)
{
printf(" % - 9s:%9.2f / n,月[i],销售[i]);
}
storeSales(月,销售);
printResults(月,销售);
返回0;
}
void storeSales(char months [] [15 ],双倍销售[])
{
int i = 0;
for(i = 0;我<尺寸; i ++)
{
do
{
printf(" Enter the store'' %s的销售额:",
个月[i]);
scanf(9.2%lf,& sales [i]) ;
printf(" \ n");
}
while((sales [i]< 0.00)||(销售[i]> 100000.00));
}
}
-------------- --------------
i需要打印结果...
最低,最高和平均...... heeeeelp!请?我欠你一个!!
i accidentially erased something someone helped me write and i am soooo
in trouble if i dont fix this, i really need the help!!!!!
heres what i have:
/*
*/
#include <stdio.h>
#include <stdlib.h>
#define SIZE 12
void printResults (char months[][15], double sales[]);
void storeSales (char months[][15], double sales[]);
int main ( void )
{
system ("clear");
int i;
double sales[ SIZE ];
char months [SIZE][15] = {"January", "February", "March", "April",
"May",
"June", "July", "August", "September", "October",
"November", "December"};
for (i = 0; i < SIZE; i++)
{
printf("%-9s: %9.2f/n", months[ i ], sales[ i ]);
}
storeSales (months, sales);
printResults (months, sales);
return 0;
}
void storeSales ( char months[][15], double sales[] )
{
int i = 0;
for ( i = 0; i < SIZE; i++ )
{
do
{
printf("Enter the store''s sales for the month of %s:",
months[ i ]);
scanf( "9.2%lf", &sales [ i ]);
printf("\n");
}
while ((sales[ i ] < 0.00 ) || ( sales[ i ] > 100000.00));
}
}
----------------------------
i need the printresults...
lowest, highest, and average... heeeeelp! please? i will owe u one!!
推荐答案
" honeygrl33" < GI ************* @ aol.com>在消息中写道
news:11 ********************** @ c13g2000cwb.googlegr oups.com ...
"honeygrl33" <gi*************@aol.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
继承人我所拥有的:
#define SIZE 12
void printResults(char months [] [15],double sales []);
void storeSales(char months [] [15],double sales []);
----------------------------
我需要打印结果......
最低,最高和平均...... heeeeelp!请?我欠你一个!!
heres what i have:
#define SIZE 12
void printResults (char months[][15], double sales[]);
void storeSales (char months[][15], double sales[]);
----------------------------
i need the printresults...
lowest, highest, and average... heeeeelp! please? i will owe u one!!
您需要遍历销售数组并查找平均值,即
总和除以元素的数量。你会想要一个for循环为
这个。
当你遍历阵列时,你也想要捕获最低的$ / b
和最高值。你需要2if对此的陈述。
你到目前为止还在赛道上吗?
karl m
You need to traverse your sales array and find the average, which is the
total sum divided by the number of elements. You''ll want a "for" loop for
this.
While you''re traversing the array, you''ll also want to capture the lowest
and highest values. You''ll need 2 "if" statements for this.
Are you on-track so far?
karl m
honeygrl33写道:
honeygrl33 wrote:
我意外地删除了有人帮助我写的东西,我很麻烦如果我不解决这个问题,我真的需要帮助!!!!!
以下是我所拥有的:
/ *
* /
<< clip>> ----------------------------
我需要打印结果......
最低,最高和平均。 .. heeeeelp!请?我欠你一个!!
i accidentially erased something someone helped me write and i am soooo
in trouble if i dont fix this, i really need the help!!!!!
heres what i have:
/*
*/
<<clip>> ----------------------------
i need the printresults...
lowest, highest, and average... heeeeelp! please? i will owe u one!!
/ *这是我的实现:* /
#include< stdio.h>
#include< stdlib.h>
#define SIZE 12
void printResults(char months [] [ 15],双重销售[]);
void storeSales(char months [] [15],double sales []);
/ *问题''storeSales'',你应该修理它们。* /
int main(无效)
{
system(" ;清除);
int i;
双倍销售额[SIZE];
char个月[SIZE] [15] = {" 1月,2月,3月,4月,
5月,6月,7月,8月,9月等。 ,十月,
"十一月",十二月"};
for(i = 0; i< SIZE; i ++)
{
printf("% - 9s:%9.2f \ n",months [i],sales [i]);
}
storeSales(月,销售);
printResults(月,销售);
返回0;
}
void storeSales(char months [] [15],double sales [])
{
int i (0 =
for(i = 0;我<尺寸; i ++)
{
do
{
printf(" Enter the store'' %s的销售额:",
个月[i]);
scanf(9.2%lf,& sales [i]) ;
printf(" \ n");
}
while((sales [i]< 0.00)||( sales [i]> 100000.00));
}
}
void printResults(char months [] [15] ,双倍销售[])
{
int i;
双最低= 0.0,最高= 0.0,平均= 0.0;
for(i = 0; i< SIZE; i ++)
average = average +(sales [i] / SIZE);
>
printf(平均值:%lf \ n,平均值);
最低=销售额[0];
for(i = 0; i< SIZE; i ++){
if(最低>销售[i]){
最低=销售额[i];
}
}
printf(最低价:%lf \ n,最低价);
最高=销售额[0];
(i = 0; i< SIZE; i ++){
if(最高< sales [i]){
最高=销售[i];
}
}
printf(最高:%lf \ n,最高);
}
/ *结束* /
/* Here is my implementation: */
#include <stdio.h>
#include <stdlib.h>
#define SIZE 12
void printResults (char months[][15], double sales[]);
void storeSales (char months[][15], double sales[]);
/* Problems with ''storeSales'', you should fix them.*/
int main ( void )
{
system ("clear");
int i;
double sales[ SIZE ];
char months [SIZE][15] = {"January", "February", "March", "April",
"May", "June", "July", "August", "September", "October",
"November", "December"};
for (i = 0; i < SIZE; i++)
{
printf("%-9s: %9.2f\n", months[ i ], sales[ i ]);
}
storeSales (months, sales);
printResults (months, sales);
return 0;
}
void storeSales ( char months[][15], double sales[] )
{
int i = 0;
for ( i = 0; i < SIZE; i++ )
{
do
{
printf("Enter the store''s sales for the month of %s:",
months[ i ]);
scanf( "9.2%lf", &sales [ i ]);
printf("\n");
}
while ((sales[ i ] < 0.00 ) || ( sales[ i ] > 100000.00));
}
}
void printResults (char months[][15], double sales[])
{
int i;
double lowest = 0.0, highest = 0.0, average = 0.0;
for (i = 0 ; i < SIZE ; i++)
average = average + (sales[i] / SIZE);
printf ("Average: %lf\n", average);
lowest = sales[0];
for (i = 0 ; i < SIZE ; i++) {
if (lowest > sales[i]) {
lowest = sales[i];
}
}
printf ("Lowest: %lf\n", lowest);
highest = sales[0];
for (i = 0 ; i < SIZE ; i++) {
if (highest < sales[i]) {
highest = sales[i];
}
}
printf ("Highest: %lf\n", highest);
}
/* The End */
AIM me !! girliegirl4ever
非常感谢
AIM me!! girliegirl4ever
thanks so much
这篇关于救命! :(的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!