Skip to content

Commit 6374b3d

Browse files
bernhardmgrubersponce
authored andcommitted
Fix signed/unsigned conversion warning
1 parent 0760ee1 commit 6374b3d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

code/control/control.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ constexpr unsigned int numbers[]{1000001, 1000002, 1000003, 1000004, 1000005, 10
55
bool isodd(unsigned int i) { return i % 2 == 1; }
66

77
void part1() {
8-
int sum_odd = 0;
9-
int sum_eve = 0;
8+
unsigned int sum_odd = 0;
9+
unsigned int sum_eve = 0;
1010
for (int i = 0; i < 9; ++i) {
1111
unsigned int num = numbers[i];
1212
if (isodd(num)) {

code/control/solution/control.sol.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ constexpr unsigned int numbers[]{1000001, 1000002, 1000003, 1000004, 1000005, 10
55
bool isodd(unsigned int i) { return i % 2 == 1; }
66

77
void part1() {
8-
int sum_odd = 0;
9-
int sum_eve = 0;
8+
unsigned int sum_odd = 0;
9+
unsigned int sum_eve = 0;
1010
for (unsigned int num : numbers) {
1111
// Note the usage of ternary expression to select the sum to which we add
1212
// the ternary expression returns a reference to the right sum

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