Skip to content

Commit c46e46d

Browse files
authored
Fix Love-Calculator
It wasn't working with spaces and uppercase.
1 parent b4ea320 commit c46e46d

File tree

1 file changed

+7
-7
lines changed
  • Windows_System_examples/Love-Calculator

1 file changed

+7
-7
lines changed

Windows_System_examples/Love-Calculator/main.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
#include <stdlib.h>
33

44

5-
void enter_string(char* message, char* s, size_t s_size) {
5+
void enter_string(char* message, char* s, size_t s_size)
6+
{
67
printf("%s", message);
78
fgets(s, s_size, stdin);
89
}
@@ -23,13 +24,12 @@ int get_score(char* s)
2324
char c;
2425
for(char* p = s; p != end; ++p)
2526
{
26-
c = *p ^ 0x20;
27+
c = *p;
28+
if(c == ' ') continue;
2729

28-
if(c == ' ')
29-
{
30-
continue;
31-
}
32-
else if(c >= 'A' && c <= 'Z')
30+
c &= ~0x20;
31+
32+
if(c >= 'A' && c <= 'Z')
3333
{
3434
score += c - '@';
3535
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy