我的知识有限,所以请耐心等待,但我正在尝试创建功能,这是我到目前为止所得到的,但它并没有。所有建议表示赞赏!尝试创建一个收集用户输入的函数
#include<stdio.h>
int GetIntFromUser(int grades[5]);
int GetIntFromUser(int grades[5])
{
int counter = 0;
int incre = 1;
while(counter < 4)
{
printf("Please enter GPA %d: ",incre);
scanf("%d",&grades[counter]);
incre++;
counter++;
}
}
int main()
{
int sum = 0;
int grades[5];
int counter = 0;
printf(GetIntFromUser());
while(counter < 4)
{
sum = sum + grades[counter];
counter++;
}
float gpa = (float)sum/counter;
printf("The average GPA is %.2f\n",gpa);
return 0;
}
答案 0 :(得分:0)
试试这个:
<table class="table table-bordered">
<tr>
<th>Status</th>
<th>Title</th>
<th>Author</th>
<th>Latest Updated</th>
</tr>
{% for article in articles %}
<tr>
<td>{{ article.status }}</td>
<td>{{ article.title }}</td>
<td>{{ article.author }}</td>
<td>{{ article.date_updated }}</td>
</tr>
{% endfor %}
</table>
您还有一个包含5个元素的数组,但您只使用4个。