Commit c05dd23e authored by jinny.wilkin's avatar jinny.wilkin

Consistent with Report, still to add 2 functions, comments and tidy up

parent 5708520f
File added
No preview for this file type
...@@ -14,7 +14,7 @@ typedef struct Pokemon{ ...@@ -14,7 +14,7 @@ typedef struct Pokemon{
typedef struct Trainers{ typedef struct Trainers{
char name[50]; char name[50];
Pokemon owned[400]; Pokemon owned[1000];
int totalOwned; int totalOwned;
} Trainers; } Trainers;
...@@ -116,6 +116,7 @@ char* stripSpace(char* string){ ...@@ -116,6 +116,7 @@ char* stripSpace(char* string){
int c = 0, d = 0; int c = 0, d = 0;
while(string[c] != '\0') while(string[c] != '\0')
{ {
string[c] = tolower(string[c]);
if(!(string[c] == ' ' && string[c+1] == ' ')){ if(!(string[c] == ' ' && string[c+1] == ' ')){
final[d] = string[c]; final[d] = string[c];
d++; d++;
...@@ -124,6 +125,7 @@ char* stripSpace(char* string){ ...@@ -124,6 +125,7 @@ char* stripSpace(char* string){
} }
string[d] = '\0'; string[d] = '\0';
string[strcspn(string, "\n")] = 0; string[strcspn(string, "\n")] = 0;
string[0] = toupper(string[0]);
//printf("\n%s<-ends here", string); //printf("\n%s<-ends here", string);
return string; return string;
} }
...@@ -140,7 +142,6 @@ int identify(){ ...@@ -140,7 +142,6 @@ int identify(){
printf("\nEnter the Pokemon's Name: "); printf("\nEnter the Pokemon's Name: ");
char str[13]; char str[13];
fgets(str, 13, stdin); fgets(str, 13, stdin);
str[0] = toupper(str[0]);
stripSpace(str); stripSpace(str);
int count = -1; int count = -1;
int comparitor = 1; int comparitor = 1;
...@@ -172,7 +173,6 @@ int identify(){ ...@@ -172,7 +173,6 @@ int identify(){
case '3': case '3':
printf("\nEnter Pokemon Type: "); printf("\nEnter Pokemon Type: ");
fgets(str, 13, stdin); fgets(str, 13, stdin);
str[0] = toupper(str[0]);
stripSpace(str); stripSpace(str);
count = 0; count = 0;
int output = 0; int output = 0;
...@@ -190,7 +190,6 @@ int identify(){ ...@@ -190,7 +190,6 @@ int identify(){
case '4': case '4':
printf("\nEnter Pokemon Type: "); printf("\nEnter Pokemon Type: ");
fgets(str, 13, stdin); fgets(str, 13, stdin);
str[0] = toupper(str[0]);
stripSpace(str); stripSpace(str);
count = 0; count = 0;
output = 0; output = 0;
......
File added
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment