Results 1 to 3 of 3
hi guys!! I am new C user. Recently i have been given this assignment by school and i am seriously having some difficulties,
In my program this part i am ...
- 08-23-2007 #1Just Joined!
- Join Date
- Aug 2007
- Posts
- 2
Tennis Scoreboard
hi guys!! I am new C user. Recently i have been given this assignment by school and i am seriously having some difficulties,
In my program this part i am suppose to get to make a program that prints out the scoreboard of a tennis game.
The input to your prgram will be a series of characters A, B and S, with line breaks at appropriate intervals. The character A indicates a point won by Team A; B indicates a point won by Team B.
For example, if the user keys in BSAAAABBBS.
The output of the program should be
Team A to serve:
0-0
Love-15
Team B to serve:
0-1
40-Love
I have currently done until this part.. can please give some advise?
#include <stdio.h>
int main(void){
char name[]={"Love"};
int name[4] = {0 ,15, 30, 40};
int *ptr;
char ch;
// char A,B,S;
ptr = &name[0]; //point our pointer to the first element of the array
printf("Please enter the scores\n");
scanf("%c", &ch);
while(ch == 'A' || ch == 'B' || ch == 'S' ) {
if( ch == 'A' ) {
name[i]++;
printf(" %d ",i,my_array[i]);
}
else if( ch == 'B' ) {
}
else{ //ch == 'S'
}
}
return 0;
}
// printf("Team %f to serve:\n");
- 08-24-2007 #2
As per Forum Rules Point 4, no homework questions please.
"I am not an alcoholic, alcoholics go to meetings"
Registered Linux user = #372327
- 08-24-2007 #3Just Joined!
- Join Date
- Aug 2007
- Posts
- 2
haha.. okay.. thanks..didnt read tat


Reply With Quote