As mentioned i don't copy your code because it's not helping me learning programming and the commands. A plea would be to comment everything except the very basic commands and maybe describe how they work, respectively what input they demand, what output they give, how i can work with the result it's giving etc. Like i said, i'm a bloody noob, and i'm afraid i don't have much time to read about all the new commands because in one month the written exam phase begins with five exams like higher mathematics, technical mechanics and shit like that.^^
Ok thanks dear sirs, here is what i could come up with:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#include <iostream>
#include "stdafx.h"
#include "conio.h"
#include "string"
#include "stdio.h"
using namespace std;
string length(string ISBN) {
int i;
string normalized;
for (i = 0, i < ISBN.length()) {
if (ISBN[i] == "-") {
ISBN.erase(i);
}
else {
normalized = normalized += ISBN[i];
i++;
}
}
}
string check(string normalized) {
int j;
string compared;
for (j = 0; j < normalized.length()) {
if (isdigit(normalized[j])) {
compared = compared += normalized[j];
j++;
}
else
j++;
}
}
bool validation {
if ((normalized.length == 10) && (compared.length == 10)) {
return true;
}
else {
return false;
}
}
int main() {
string isbn;
cout << "Please enter the ISB number for validation: \n";
cin >> isbn;
if (validation == true) {
cout << "The entered ISBN is valid.\n";
}
else
cout << "The entered ISBN is not valid.\n";
_getch;
return 0;
}
|
As you can see with the error messages, this program is a pure disgrace as it has nearly as much errors as lines...
Severity Code Description Line Suppression State
Warning C4018 '<': signed/unsigned mismatch 11
Warning C4018 '<': signed/unsigned mismatch 25
Error C2446 '==': no conversion from 'const char *' to 'int' 12
Error C2447 '{': missing function header (old-style formal list?) 36
Error C2447 '{': missing function header (old-style formal list?) 39
Error C2447 '{': missing function header (old-style formal list?) 44
Error (active) expected a ';' 11
Error (active) expected a ';' 25
Error (active) expected a ';' 44
Error (active) expected an expression 36
Error (active) operand types are incompatible ("char" and "const char *") 12
Error C2059 syntax error: 'else' 39
Error C2059 syntax error: 'if' 36
Error C2059 syntax error: '}' 42
Error C2143 syntax error: missing ')' before '{' 11
Error C2143 syntax error: missing ';' before ')' 11
Error C2143 syntax error: missing ';' before ')' 25
Error C2143 syntax error: missing ';' before '{' 11
Error C2143 syntax error: missing ';' before '{' 36
Error C2143 syntax error: missing ';' before '{' 39
Error C2143 syntax error: missing ';' before '{' 44
Error C2143 syntax error: missing ';' before '}' 42
Thanks for your patience.
I don't get these error messages. Especially the missing";" ones. I don't put semicolons into loop requirements, do i?