# Thread: HELP!! College Assignment

1. ## HELP!! College Assignment

could do with a bit of help out there off anyone who knows much bout c im a complete novice here
so far we have only been doing code using #include<stdio.h>

much appreciated from who ever helps me out here

The main function is to consist of function calls only.

At least three functions are to be used to allow the user to:
1. Input the names and surnames of up to 30 students, using a for loop.
2. Input the names of up to six subjects, using a while loop.
3. Input the marks achieved by each student in the subjects, using a do while loop.
4. Calculate the average mark for each student.
5. Output the name and average mark for each student.

The user is to be allowed repeat the entire process as often as she wishes.

i have a sample one here that needs to be modified help would be much appreciated
Code:
```#include<stdio.h>
char Names[30][10];
int SUB1[30];
int SUB2[30];
int SUB3[30];
float AVG[30];
int num,i,val;
main()
{
clrscr();
select();
}
select()
{
printf("\n do you want to input or to exit?");
printf("\n input 1 to go to input function 2 to exit");
scanf("%d",&val);
if(val==1)
input();
else
exit(1);
}
input()
{
i=0;
printf("\n how many names do you want to input?");
scanf("%d",&num);
for(i=0;i<num;i++)
{
printf("\n what is the name %d: ?",i+1);
scanf("%s",&Names[i]);
printf("\n what is mark %d:?",i+1);
scanf("%d",&SUB1[i]);
printf("\n what is mark %d:? for sub 2",i+1);
scanf("%d",& SUB2[i]);
printf("\n what is mark %d:? for sub3 ",i+1);
scanf("%d",&SUB3[i]);
}
calc();
getch();
}
calc()
{
i=0;
while(i<num)
{
AVG[i]=(SUB1[i]+SUB2[i]+SUB3[i])/3;
i++;
}
output();
}
output()
{
i=0;
do
{

printf("\n your name is : %s",Names[i]);
printf("\n your marks are : %d %d %d",SUB1[i],SUB2[i],SUB3[i]);
printf("\n your average is: %5.2f",AVG[i]);
i++;
}
while(i<num);
getch();
Repeat();
}
Repeat()
{
int val1;
printf("\n do you want to repeat or to exit?");
printf("\n input 1 to go to select() function ,2 to exit");
scanf("%d",&val1);
if(val1==1)
select();
else
exit(1);
}```

2. >>i have a sample one here that needs to be modified help would be much appreciated
That means you haven't put in any effort yet.
We are not going to do your homework for you. Read homework policy.
Indent your code too!!

3. First, indent your code.
Second, what is your exact problem?
Third, study about strings.
Forth, use std:uts() instead of scanf().

It's
Code:
`std::puts()`

4. This is C forum, no C++.

5. Can't you put puts() in c???
I think you should better look at it..

6. Code:
`std::puts()`
Ask yourself. Is it C or C++?
Sure plain puts() is a C function. If you are not sure, try to compile with a C compiler.

7. Lol... My bad.... In code...
Sorry... Code was of c++...
Good Bayint Naung...

8. Forth, use std:uts() instead of scanf().
This is C forum
Please take a moment to think before posting answers, consider if the advice is accurate, and useful first.

9. Originally Posted by rogster001
This is C forum
Please take a moment to think before posting answers, consider if the advice is accurate, and useful first.
1. There is nothing like std:uts(). :-@
2. I already mentioned that my bad, that means, that was a mistake...
3. Sorry.

Popular pages Recent additions