fix dm2 (again)
This commit is contained in:
parent
ac8499addb
commit
4820893366
@ -34,8 +34,8 @@ int ecartmin(int t[], int size) {
|
|||||||
|
|
||||||
// Returns 0 if no integer has been detected
|
// Returns 0 if no integer has been detected
|
||||||
int extraire(char str[]) {
|
int extraire(char str[]) {
|
||||||
while ((*str != '-' || (str[1] <= '0' || str[1] >= '9')) &&
|
while ((*str != '-' || (str[1] < '0' || str[1] > '9')) &&
|
||||||
(*str <= '0' || *str >= '9')) {
|
(*str < '0' || *str > '9')) {
|
||||||
if (*str == 0) {
|
if (*str == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -119,8 +119,8 @@ bool palindrome2(char str[]) {
|
|||||||
int sommeentiers(char str[]) {
|
int sommeentiers(char str[]) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
while ((*str != '-' || (str[1] <= '0' || str[1] >= '9')) &&
|
while ((*str != '-' || (str[1] < '0' || str[1] > '9')) &&
|
||||||
(*str <= '0' || *str >= '9')) {
|
(*str < '0' || *str > '9')) {
|
||||||
if (*str == 0) {
|
if (*str == 0) {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// This is a modified version of the dm that sticks with what
|
// This is a modified version of the dm that sticks with what
|
||||||
// we are allowed to do (no fancy pointer arithmetic)
|
// we are allowed to do (no fancy pointer arithmetic)
|
||||||
|
#include "test_dm1.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -37,8 +38,8 @@ int ecartmin(int t[], int size) {
|
|||||||
// Returns 0 if no integer has been detected
|
// Returns 0 if no integer has been detected
|
||||||
int extraire(char str[]) {
|
int extraire(char str[]) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while ((str[i] != '-' || (str[i + 1] <= '0' || str[i + 1] >= '9')) &&
|
while ((str[i] != '-' || (str[i + 1] < '0' || str[i + 1] > '9')) &&
|
||||||
(str[i] <= '0' || str[i] >= '9')) {
|
(str[i] < '0' || str[i] > '9')) {
|
||||||
if (str[i] == 0) {
|
if (str[i] == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -125,8 +126,8 @@ int sommeentiers(char str[]) {
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
while ((str[i] != '-' || (str[i + 1] <= '0' || str[i + 1] >= '9')) &&
|
while ((str[i] != '-' || (str[i + 1] < '0' || str[i + 1] > '9')) &&
|
||||||
(str[i] <= '0' || str[i] >= '9')) {
|
(str[i] < '0' || str[i] > '9')) {
|
||||||
if (str[i] == 0) {
|
if (str[i] == 0) {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user