That is true, so every global data should be a class with functions to access its contents. The functions allow to control simultaneous access from different threads and can check data for validity...
Type: Posts; User: modwind
That is true, so every global data should be a class with functions to access its contents. The functions allow to control simultaneous access from different threads and can check data for validity...
rogster001, this IS a Caeser Cipher.
That task is not hard. You should use 2 arrays of chars:
char plaintext[26];
char cypher[26];
Fill the first one with A-Z.
Start to fill the second one by...
Your code is too complicated. Try something like this (read one record at a time):
fstream file("AirLine.txt", ios::in | ios::out | ios::app | ios::binary);
file.seekg(0, ios::beg);
...
jackirl, sizeof(string) has no useful meaning. It does not show real amount of memory required to store a string in a file. And this amount is variable, equal to current number of characters in it.
int is generally a 4-byte (32 bit) value. The maximum number of binary digits needed to represent it is 32.
To write an STL container like std::list or even std::vector, a lot of effort is needed. Not only coding and testing but developing interfaces. IMHO your main mistake is implementing some random...
Why so serious? It was just a game to make shorter code. Everyone understands it is not an example for real life. Like assembler demos 256 bytes or 64k long.
The program counts a sum of arithmetic progression starting from 1 to the input number and should stop on invalid input. There is a mistake in czarny020's code: when you enter text, it loops...
I think CatastropheNoob wants a "custom sized array of named objects". It is easy to achieve with std::map:
std::map<std::string,std::string> mymap;
mymap["name1"]="an element";...
You should use conversion only when target type can contain smaller amount of data (assignment of "short" to "char" for example).
By position I mean that "DS0008D-0111A", "DS0080D-0111A" will give...
1. When you find the string's length, you have a mistake:
for(j=0;s[j]!='\0';j++)
;
j--;
2. 10100 is correct binary for decimal 20.
You're using type conversions incorrectly:
chksum+= (unsigned short)*(start_addr+i);(unsigned short) is not needed here.
chksum = (char)~chksum;(char) truncates your checksum from 2 bytes to 1....
Why do you want to compare characters? Probably it would be better to create a function that converts chars to booleans, and then it is easy to use any standard operators.
bool CharToBool(char...
To be sure that your array has valid size and you are able to iterate through it, use constants instead of defines. The preferable type is "size_t" which is unsigned integer that can fit any possible...
I get warnings from gcc when your code is compiled:
unknown conversion type character 'L' in format
too many arguments for format
Seems the compiller does not support long doubles input.
...