Thread: while loop error. string errors. converting between single chars in c++

  1. #1
    Registered User
    Join Date
    Jul 2018
    Posts
    8

    while loop error. string errors. converting between single chars in c++

    Hi,

    I'm getting a couple errors in c++;

    What I'm trying to do is covert some character to another character.
    for file output.

    the while loop is messing up pretty bad Microsoft is throwin some random
    characters in there instead of using the right ones..

    I was trying to use getline to get strings and just edit the strings.
    but app is erroring out and everything.
    I can use file.get(cstr); and I have to get 1 char at a time.
    but it wont let me change characters in a string in a while loop.

    dev c++. has some probs. I'm using vs2017 community.
    atoi not working so its hard to covert between characters.
    strcpy not working. looks like they threw out some old stuff.

    string has a problem getting single characters off the string.
    but I can still convert char to string which is ok. and using int to string.
    this is just basic c++ stuff and they threw us out of it just for some while loop and string exploit probably.

    anyway what I got going on is.. I'm using get to get single character from a file and converting them. but because of while loop I can only convert 1 char in the entire prog. unless I want I want to write out the binary table again and again. but I can convert int to string np..

    any ideas on how to get some more accurate results in changing single string character. or way to fix while loop.
    ive heard before using String sometimes helps with the new stuff.
    but I don't know how to single string char in and out of there from string.

    what I'm working on is something other than ascii. but even though
    it is what it uses to record char if I could see my binary it would be
    easier to work on it.
    like I said I got it working I just returns 1char per running of the file without a while loop. I found something in binary. everybody knows
    like ascii is 256bit. but they are just recording ascii in that amount.
    its really 1 or 0 a time eight bit. so its half of 256 is what a real program uses 128. which is considerd encrypted. or is what it is in
    8bit encryption including the 0 in other words as part of a bit in enc.

    any help with String or anything I might be able to convert single characters to in a while loop. or another solution is appreaciated.

    strcpy isn't working either. what a fog of of c++. I don't like it.

    -lgm

  2. #2
    Registered User
    Join Date
    Jul 2018
    Posts
    8
    Hers what I got in code right now. I would love to implement a couple while loop to get it outputting a whole file in new char.. it does convert the char. but not working in a while.
    so each I time I run it it only converts one char. if I used getline to get the lin leng I still wouldn't know what line it was on when I opend the file. its making me a little sad. seems
    like somebody finally lost the original c++ copy. hehe

    Code:
    #include "stdafx.h"
    #include <string>
    #include <iostream>
    #include <fstream>
    using namespace std;
    
    int main() {
     string a = ""; string vg = ""; int bug = 0; char db; char cg[200]; string fnam = "";
     int x = 0; string fnam;
     //cout << "FileName; "; cin >> fnam; 
     
     ifstream file("form.txt");
     file.get(db); a = db; 
      if (a == "0") { bug = 70;  vg = vg + "G"; } if (a == "1") { bug = 71;  vg = vg + "H"; }
      if (a == "2") { bug = 72;  vg = vg + "I"; } if (a == "3") { bug = 73;  vg = vg + "J"; }
      if (a == "4") { bug = 74;  vg = vg + "K"; } if (a == "5") { bug = 75;  vg = vg + "L"; }
      if (a == "6") { bug = 76;  vg = vg + "M"; } if (a == "7") { bug = 77;  vg = vg + "N"; }
      if (a == "8") { bug = 78;  vg = vg + "O"; } if (a == "9") { bug = 79;  vg = vg + "P"; }
      if (a == "A") { bug = 34;  vg = vg + "\""; } if (a == "B") { bug = 35;  vg = vg + "#"; }
      if (a == "C") { bug = 36;  vg = vg + "$"; } if (a == "D") { bug = 37;  vg = vg + "%"; }
      if (a == "E") { bug = 38;  vg = vg + "&"; } if (a == "F") { bug = 39;  vg = vg + "'"; }
      if (a == "G") { bug = 40;  vg = vg + "("; } if (a == "H") { bug = 41;  vg = vg + ")"; }
      if (a == "I") { bug = 42;  vg = vg + "*"; } if (a == "J") { bug = 43;  vg = vg + "+"; }
      if (a == "K") { bug = 44;  vg = vg + ","; } if (a == "L") { bug = 45;  vg = vg + "-"; }
      if (a == "M") { bug = 46;  vg = vg + "."; } if (a == "N") { bug = 47;  vg = vg + "/"; }
      if (a == "O") { bug = 48;  vg = vg + "0"; } if (a == "P") { bug = 49;  vg = vg + "1"; }
      if (a == "Q") { bug = 50;  vg = vg + "2"; } if (a == "R") { bug = 51;  vg = vg + "3"; }
      if (a == "S") { bug = 52;  vg = vg + "4"; } if (a == "T") { bug = 53;  vg = vg + "5"; }
      if (a == "U") { bug = 54;  vg = vg + "6"; } if (a == "V") { bug = 55;  vg = vg + "7"; }
      if (a == "W") { bug = 56;  vg = vg + "8"; } if (a == "X") { bug = 57;  vg = vg + "9"; }
      if (a == "Y") { bug = 58;  vg = vg + ":"; } if (a == "Z") { bug = 59;  vg = vg + ";"; }
      if (a == "a") { bug = 82;  vg = vg + "R"; } if (a == "b") { bug = 83;  vg = vg + "S"; }
      if (a == "c") { bug = 84;  vg = vg + "T"; } if (a == "d") { bug = 85;  vg = vg + "U"; }
      if (a == "e") { bug = 86;  vg = vg + "V"; } if (a == "f") { bug = 87;  vg = vg + "W"; }
      if (a == "g") { bug = 88;  vg = vg + "X"; } if (a == "h") { bug = 89;  vg = vg + "Y"; }
      if (a == "i") { bug = 90;  vg = vg + "Z"; } if (a == "j") { bug = 91;  vg = vg + "["; }
      if (a == "k") { bug = 92;  vg = vg + "\\"; } if (a == "l") { bug = 93;  vg = vg + "]"; }
      if (a == "m") { bug = 94;  vg = vg + "^"; } if (a == "n") { bug = 95;  vg = vg + "_"; }
      if (a == "o") { bug = 96;  vg = vg + "`"; } if (a == "p") { bug = 97;  vg = vg + "a"; }
      if (a == "q") { bug = 98;  vg = vg + "b"; } if (a == "r") { bug = 99;  vg = vg + "c"; }
      if (a == "s") { bug = 100;  vg = vg + "d"; } if (a == "t") { bug = 101;  vg = vg + "e"; }
      if (a == "u") { bug = 102;  vg = vg + "f"; } if (a == "v") { bug = 103;  vg = vg + "g"; }
      if (a == "w") { bug = 104;  vg = vg + "h"; } if (a == "x") { bug = 105;  vg = vg + "i"; }
      if (a == "y") { bug = 106;  vg = vg + "j"; } if (a == "z") { bug = 107;  vg = vg + "k"; }
      if (a == " ") { bug = 160;  vg = vg + " "; }
      cout << bug << " " << a << " " << vg << " \n";
      ofstream filb("bin.txt", ios::app);
      filb << vg;
     
     file.close();
     }
    Last edited by lgmbin; 07-15-2018 at 09:35 PM. Reason: small mistake

  3. #3
    Registered User
    Join Date
    Dec 2017
    Posts
    1,630
    I don't understand exactly what you're trying to do, and the word salad doesn't help much (English is presumably not your first language).
    In particular, I don't know what you want with the "bug" numbers.
    Here's a program that converts the characters.
    You can get the "bug" numbers as bug[i] if you want, but I haven't done anything with them below.
    Code:
    #include <string>
    #include <iostream>
    #include <fstream>
    using namespace std;
     
    int main() {
        string in("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ");
        string out("GHIJKLMNOP\"#$%&'()*+,-./0123456789:;RSTUVWXYZ[\\]^_`abcdefghijk ");
        int bug[] = {
            70,71,72,73,74,75,76,77,78,79,
            34,35,36,37,38,39,40,41,42,43,
            44,45,46,47,48,49,50,51,52,53,
            54,55,56,57,58,59,82,83,84,85,
            86,87,88,89,90,91,92,93,94,95,
            96,97,98,99,100,101,102,103,104,105,
            106,107,160
        };
    
        ifstream fin("form.txt");
        if (!fin) {
            cerr << "Error opening input file.\n";
            return 0;
        }
    
        ofstream fout("form.out");
        if (!fout) {
            cerr << "Error opening output file.\n";
            return 0;
        }
    
        char ch;
        while (fin.get(ch)) {
            size_t i = in.find(ch);
            if (i != in.npos)
                fout << out[i];
            else
                fout << ch;  // output character unchanged (e.g., '\n')
        }
    }
    A little inaccuracy saves tons of explanation. - H.H. Munro

  4. #4
    Registered User
    Join Date
    Jul 2018
    Posts
    8
    i can show you this binary project. ascii uses 256 bit binaries to = a character. but i strongly believe programs in 256bit should probably not be written.
    the binary clearly states 1 or 0 in ints. but the char is of. its probably why our computer are so buggy. you can still use 256bit char but should realize that
    in 8bit a program runs in 128 with the zero and the 1. i know they got the old stuff. in 16bit. that's 256. but the char is still off in even 128. we would have much better programs.

    anyway heres the binary proj I'm working on. its not the same old pre windows asci. binary but. its the binary that runs not the char or int. i believe... anyway.

    the reason why i made this proj is because i can see what real code looks like in 8bit. to decide what to do in the machine code. whether its in windows or running on hardware.
    but why would you use pre windows binary anyway i guess they haven decided to do it. but i know Microsoft has their own version ansi and stuff like that. but why doesn't anybody.
    have or explain tru 32 bit code in 128.

    Lemi get some binary. looks ok 128 bit.
    Values
    00110000 0 01000110 70
    00110001 1 01000111 71
    00110010 2 01001000 72
    00110011 3 01001001 73
    00110100 4 01001010 74
    00110101 5 01001011 75
    00110110 6 01001100 76
    00110111 7 01001101 77
    00111000 8 01001110 78
    00111001 9 01001111 79
    Letters
    01000001 A 00100010 34
    01000010 B 00100011 35
    01000011 C 00100100 36
    01000100 D 00100101 37
    01000101 E 00100110 38
    01000110 F 00100111 39
    01000111 G 00101000 40
    01001000 H 00101001 41
    01001001 I 00101010 42
    01001010 J 00101011 43
    01001011 K 00101100 44
    01001100 L 00101101 45
    01001101 M 00101110 46
    01001110 N 00101111 47
    01001111 O 00110000 48
    01010000 P 00110001 49
    01010001 Q 00110010 50
    01010010 R 00110011 51
    01010011 S 00110100 52
    01010100 T 00110101 53
    01010101 U 00110110 54
    01010110 V 00110111 55
    01010111 W 00111000 56
    01011000 X 00111001 57
    01011001 Y 00111010 58
    01011010 Z 00111011 59
    Variable
    01100001 a 01010010 82
    01100010 b 01010011 83
    01100011 c 01010100 84
    01100100 d 01010101 85
    01100101 e 01010110 86
    01100110 f 01010111 87
    01100111 g 01011000 88
    01101000 h 01011001 89
    01101001 i 01011010 90
    01101010 j 01011011 91
    01101011 k 01011100 92
    01101100 l 01011101 93
    01101101 m 01011110 94
    01101110 n 01011111 95
    01101111 o 01100000 96
    01110000 p 01100001 97
    01110001 q 01100010 98
    01110010 r 01100011 99
    01110011 s 01100100 100
    01110100 t 01100101 101
    01110101 u 01100110 102
    01110110 v 01100111 103
    01110111 w 01101000 104
    01111000 x 01101001 105
    01111001 y 01101010 106
    01111010 z 01101011 107
    128bit. 8bit binary is 128bit its 8bits either 1 or 0. that 2x 128bit. thats how its supposed to work. this binary is compatable with exe.
    to convert a binary to int. its easy.
    128 64 32 16 8 4 2 1
    0 1 0 1 0 0 0 1 81
    if its a 1 you add the numbers across. so this number is 81. ya can check it online.. you can use it to get a system of number going...

  5. #5
    Registered User
    Join Date
    Dec 2017
    Posts
    1,630
    I have no idea what you are babbling about.
    Maybe someone else can help you.
    A little inaccuracy saves tons of explanation. - H.H. Munro

  6. #6
    Registered User
    Join Date
    Jul 2018
    Posts
    8
    Quote Originally Posted by john.c View Post
    I have no idea what you are babbling about.
    Maybe someone else can help you.
    its just a project I'm working on.
    i tried that method you wrote. int in.find(ch);
    the int is still coming out incorrect in a while loop.
    i tried a couple methods. it might work out a while loop.

    has anyone tried enum before or know how i could use it with string to get a diff character. a cin will work to another char. but its single chars.

    thanks anyway. i really hope it can be fixed some way.

  7. #7
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Please show a small example of your input file, and show the output you expect with that input.

    Next do you know the difference between the following "A", 'A', and 65?

    the while loop is messing up pretty bad Microsoft is throwin some random
    characters in there instead of using the right ones..
    Microsoft has nothing to do about your problems. It appears to be that you're misunderstanding how characters, strings and numbers work.

    I was trying to use getline to get strings and just edit the strings.
    but app is erroring out and everything.
    So what did these errors say? Since you're not really using any strings in the program I won't even guess as to what you're doing wrong.

    I can use file.get(cstr); and I have to get 1 char at a time.
    but it wont let me change characters in a string in a while loop.
    What? If you're doing things right you can change characters within a string, as long as the string is not a const.

    dev c++. has some probs.
    Again what does this mean? The problems are probably because you downloaded an old version or failed to properly configure the compiler.

    I'm using vs2017 community.
    atoi not working so its hard to covert between characters.
    strcpy not working. looks like they threw out some old stuff.
    Do you realize that atoi() expects a C-string as a parameter?

    Well this is a known problem with the Microsoft compiler, it is not following the standard in regard to C string functions. However if you read the error message when you try to use a C string function the error message tells you how to solve the problem by #defining a macro to avoid the error. But since you're using std::string you really have no need for a C-string, just stick with the string.

    string has a problem getting single characters off the string.
    but I can still convert char to string which is ok. and using int to string.
    This is nonsense. The problem is that you don't appear to know the difference between a string, a char, and an int.

    anyway what I got going on is.. I'm using get to get single character from a file and converting them. but because of while loop I can only convert 1 char in the entire prog. unless I want I want to write out the binary table again and again. but I can convert int to string np..
    Again this appears to be a lack of understanding how strings, char, and numbers relate.

    like I said I got it working I just returns 1char per running of the file without a while loop. I found something in binary. everybody knows
    like ascii is 256bit. but they are just recording ascii in that amount.
    Ah, so here is one of your misconceptions, ASCII is a 7 bit protocol and can only hold values between 0 and 127, anything else is not ASCII.

    It also points to another issue, on your system a char is signed meaning it can only hold a value in the range of -128 to +127, trying to use a value outside of this range produces undefined behaviour. So on your system if you try to add 10 to 'z' you are invoking undefined behaviour.

    Again post a small sample of your input file, and the expected output. It would also help if you explained the assignment requirements and objectives.

  8. #8
    Registered User
    Join Date
    Jul 2018
    Posts
    8
    I see what your saying in most of that. but that's assuming c++ is working perfectly. it really seems like it hacked up on string char and while loop. getline is working it gets line. but impossible to get to a single char at a time. I don't have an imput file prepared. all I got is a little text file I was trying to run something with. the other guy got what I was doing. but it seems Microsoft is encrypting their output and outputting what they want. it isn't usefull usually a harmfull out. some kind of error encryption rather than what I specifiy in the while.

    I got this 3 char. for wring most of the function 3 time to get the output for you.

    ABC="#$

    I think the while data output is bad and conversion mess up. you can just cout a copy char. its fine. but id have a perfect output file. I think it has been that way for a long time.
    one time I tried to work on binary and it hacked every bine I put it.

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Just show some code for ffs and stop blaming the tools.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  10. #10
    Registered User
    Join Date
    Jul 2018
    Posts
    8
    I don't have any code setup right now. I was trying to get the conversions done to see the code better. all I got is some 8bit encryption.

    Code:
    dUkeNoBie CloRiteNBug FloRitEn HugeNetSin Berdino CloriDe PulTiseN CloridE
    HinDerLand VogIsen CloriDe BlaiRsen ForMula DeginTle FlyIng BogIsen
    DriloNet Sirbende SarIten FlorideNet SerBine Cloride Shoriten FLorIda
    NeTsiN BerlingDerbin Surlington FLoriDa DurBin Sharington CloRideNo SurLing
    LibOrian FusiLBine Janisen FLorIslE Nerbin Shurlington BehSingTen ClarIten
    ShoeNighT SerinGtoN BetingShurLeng ForMinTerBin SherLingtoN JenSing BirlengtOn Genises
    GinDerVoid ShoRlengTen FloRida Henise Cjberling ForMuLa RubinSon ShurliNe
    NetSirBen Fushington ForMula DeriSen BirlenGton CutiFord SneLington ForMise
    BinEsin Turbine SurlengTon VehiSenFloRn FlorIda FushiNgtOn JanIsen HosTible
    ChaNel FuShingTon DopaMine JerIsentan FloRida DumPlinTen FusHion TerPinTen
    FerImule GuliNgton FerIsen ToneBing FloriDian RuniSword BerlingTon ForMula
    TarPinTen GusTlenet SulTinBin DerbinTen CulTspRite VusinTen DerbInDenny HosTdine
    NtSeniForD FusHion ButterNic HostTimblerLand JumbLe DurBinGton SurLeng ForMula
    RuniShFord BerLingtoN FloriDa RebilNEt SurlengTon Burleng ChanNel IseNtBurn
    FoggiLe HustleNet ChaNelinG KurLingTon DubOniC FanHiseR CurLinGton DurbiNe
    CuLeHapeNs JaniSen ForTine SurlenGton BurNisAle JuniSforD DanceLiTle SulIngTon
    EminSling FloriDa NetSheDule ShuTe ChaNce FusHiontin BlaIrJune DraInesing
    FraMeJing FasHioN SprIngs ForMula DuniNgPort FurLingTon FusIonPort FranCe
    ShaeJunisFord HanSil BerLinDense ShoeLingDim HosTile FurNish FloRida BerDinrbg
    Hubble TaniSen FloRida JaneSpeAr DurLingTon FusHion BerlinGton SpringsJena
    Number HanDle FortPortEen ShineLeerman Dubermin ChloRoPost HeriSen Derbine
    I don't expect it to work well. its not even on the electric. just some 32 bit enc with a system.
    like I said I don't have actual code yet since I'm not sure of what to do with it yet.

    I'm looking into just using ascii and some round 128bit on the electric. but I'm still not sure on how to convert code to a hardware program or anything.. must be a way with bin and ints.

    as far as the while not working. I bet someone at Microsoft would know a way to enable it.. I might there later.

  11. #11
    Registered User
    Join Date
    May 2012
    Location
    Arizona, USA
    Posts
    948
    Quote Originally Posted by lgmbin View Post
    as far as the while not working. I bet someone at Microsoft would know a way to enable it.. I might there later.
    You might want to use a "while" loop if you want it to work. None of the code you posted has any while loops in it.

    If you want help with your code you will need to post a Short, Self Contained, Compilable Example of code that you need help with. You also need to tell us the exact output you expect your program to produce, given that input. Otherwise, we can't help you much more than we already have.

  12. #12
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > I don't have any code setup right now.
    Your first post was all about "errors in my code".

    What's all this talk about encryption?
    Are you sure you don't just mean encoding?

    You seem to be very confused about bits.
    I found something in binary. everybody knows
    like ascii is 256bit. but they are just recording ascii in that amount.
    its really 1 or 0 a time eight bit. so its half of 256 is what a real program uses 128. which is considerd encrypted. or is what it is in
    8bit encryption including the 0 in other words as part of a bit in enc.
    It is common for characters to be stored in 8-bit values.
    This gives the possible range of values is 0 to 255 (256 in total), in other words 2⁸

    Actual ASCII only requires 7-bit values, but are stored in 8-bit values with the most significant bit as '0'.
    This gives the possible range of values is 0 to 127 (128 in total), in other words 2⁷

    Anyway, examples of how to read that text file you posted.
    Code:
    #include <iostream>
    #include <fstream>
    #include <string>
    #include <iomanip>
    using namespace std;
    
    // Reads whole lines, but filters out newlines from the returned buffer
    void readLines(const char *filename) {
        ifstream input(filename);
        string line;
        while ( getline(input,line) ) {
            cout << "Line:" << line << endl;
        }
        input.close();
    }
    
    // Reads whole words, but filters out spaces and newlines from the returned buffer
    void readWords(const char *filename) {
        ifstream input(filename);
        string word;
        while ( input >> word ) {
            cout << "Word:" << word << endl;
        }
        input.close();
    }
    
    // Reads characters, but filters out spaces and newlines from the returned buffer
    void readChars(const char *filename) {
        ifstream input(filename);
        char ch;
        while ( input >> ch ) {
            cout << "Char:" << hex << unsigned(ch) << "=" << ch << endl;
        }
        input.close();
    }
    
    // Reads everything
    // Note: you have to use ios::binary on windows to see every character for what it is.
    void readAllChars(const char *filename) {
        ifstream input(filename,ios::binary);
        char ch;
        while ( input.get(ch) ) {
            cout << "Char:" << setw(2) << setfill('0') << hex << unsigned(ch) << "=" << ch << endl;
        }
        input.close();
    }
    
    int main(int argc, char *argv[])
    {
        readLines("foo.txt");
        readWords("foo.txt");
        readChars("foo.txt");
        readAllChars("foo.txt");
        return 0;
    }
    
    
    
    Line:dUkeNoBie CloRiteNBug FloRitEn HugeNetSin Berdino CloriDe PulTiseN CloridE
    Line:HinDerLand VogIsen CloriDe BlaiRsen ForMula DeginTle FlyIng BogIsen
    ...
    Word:dUkeNoBie
    Word:CloRiteNBug
    Word:FloRitEn
    Word:HugeNetSin
    ...
    Char:64=d
    Char:55=U
    Char:6b=k
    Char:65=e
    Char:4e=N
    Char:6f=o
    Char:42=B
    ...
    Char:64=d
    Char:55=U
    Char:6b=k
    Char:65=e
    Char:4e=N
    Char:6f=o
    Char:42=B
    Char:69=i
    Char:65=e
    Char:20= 
    Char:43=C
    Char:6c=l
    Char:6f=o
    Char:52=R
    Char:69=i
    Char:74=t
    Char:65=e
    Char:4e=N
    Char:42=B
    Char:75=u
    Char:67=g
    Char:20=
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  13. #13
    Registered User
    Join Date
    Jul 2018
    Posts
    8
    this little if.. just me converting some ascii to 32/64 bit in encryption.
    Code:
    if(00110010001100110011010000110101){ 01001101 00101100 01001010 00110010 01010011 00101101 01001101 01001010 }
    one thing i want to add is. in 8bit theres also 2 4bits in 8. and 4 2bit in 8. this below is the enc 2 4 8.

    Code:
    here is an example of 2 bit/ 4bit binary in 8bit. which returns either 1 or 0.
    Its 128bit which means that the binary is compatable with a 32bit program. however
    the binary is encrypted. theres no 111 no 1111 no return 2 a 0000 can come up but only in 128;
    but 88 thats a better digital only 12 off of 100. but theres 12 hours in day.. go figure.
    
    :cool:
    00010001 17 00100001 33 01000100 68  10001000 136
    00010010 18 00100010 34 01000101 69  10001001 137
    00010011 19 00100011 35 01000110 70  10001010 138
    00010100 20 00100100 36 01001000 72  10001100 139
    00010101 21 00100101 37 01001001 73  10001101 140
    00010110 22 00100110 38 01001010 74  10010001 144
    00011000 24 00101000 40 01001011 75  10010010 145
    00011001 25 00101001 41 01001100 76  10010011 146
    00011010 26 00101010 42 01001101 77  10010100 147
    00011011 27 00101011 43 01010001 81  10010110 148
                00101100 44 01010010 82  10011000 152
                00101101 45 01010011 83  10011001 153
                00110001 49 01010100 84  10100010 154
                00110010 50 01010110 85  10100011 155
                00110011 51 01011000 88  10100100 156
                00110100 52 01011001 89  10100101 157
                00110101 53 01100010 98  10100110 158
                00110110 54 01100011 99  10101000 168
                            01100100 100 10101001 169
                            01100101 101 10110001 178
                            01100110 102 10110010 179
                            01101000 104 10110100 180
                            01101001 105 11000100 196
                            01101010 106 11000101 197
                            01101100 107 11000110 198
                            01101101 108 11001000 200
                                         11001001 201
                                         11001010 202
                                         11001100 203
                                         11001101 204
                                         11010001 209
                                         11010010 210
                                         11010011 211
                                         11010100 212
                                         11011000 216
                                         11011001 217

    90 Total 8bit 32bit enc. That should be all of them in encryption. each of these binary runs round in 32bit. its 2bit 32bit.
    200 ints...
    i think the 10 is numeric. the 18 is compiled. the 26 character. and the 34 is 12 over 26. also 34 is a running number.
    if you put the 26 and 34 together thats 50. now im not just making this up they are in order no 111.. its binary enc.
    now on this table 2 and 4 bit are compatable and all 8 bit is.. is 2 4bit. it is possible with if statements in c++.
    to convert 2bit 4bit into binary encryption which = 8bit chars. and bin itself is 1 or 0. not return 2 or 10..
    heres a number table decribing how to convert binary to int.

    Code:
    128 64 32 16 8 4 2 1
      0  1  0  0 0 1 1 0
    
    
    00 01 10 11
    01 10 11 00
    10 11 00 01
    11 00 01 10
    heres a two bit table
    Last edited by lgmbin; 07-17-2018 at 03:38 PM. Reason: hmm took enterd sum space

  14. #14
    Registered User
    Join Date
    May 2012
    Location
    Arizona, USA
    Posts
    948
    I'm starting to believe that lgmbin is either extremely clueless or a troll.

    lgmbin: do you want us to help you with anything? You keep throwing around numbers that don't have any context about what they mean or where they come from.

    If you want help with your encryption (or whatever you're trying to do--it's not clear to me), you'll need to give us:

    • Example input
    • Expected output
    • How you derive the output from the input

    I'm sure all of us here are quite familiar with binary and ASCII, so you don't need to explain all of that to us.

    If you don't want help but would rather continue your confused ramblings, I'll see myself out of this thread.

    PS. There are 24 hours in a day, not 12. But what does that have to do with an encryption or encoding scheme anyway?

  15. #15
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > Its 128bit which means that the binary is compatable with a 32bit program
    Statements like this are complete hogwash.

    > one thing i want to add is. in 8bit theres also 2 4bits in 8. and 4 2bit in 8. this below is the enc 2 4 8.
    This is encoding, not encryption.
    Difference between encoding and encryption - Stack Overflow

    Just how are post #10 and post #13 related?

    the binary is encrypted. theres no 111 no 1111 no return 2 a 0000 can come up but only in 128;
    but 88 thats a better digital only 12 off of 100. but theres 12 hours in day.. go figure.
    What you're basically describing (or so it seems) is Run Length Limited(RLL) encoding.

    However, your table seems to be wrong for your description.
    > 00100001 33
    This has 4 consecutive zeros.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 02-16-2010, 02:04 PM
  2. Replies: 15
    Last Post: 11-12-2008, 06:12 PM
  3. Single hex dump - Error codes / Plain errors...
    By Blackroot in forum Windows Programming
    Replies: 4
    Last Post: 04-03-2007, 03:46 AM
  4. How do I loop through a string of chars?
    By silverfoxtp in forum C++ Programming
    Replies: 9
    Last Post: 11-24-2003, 11:04 AM
  5. concatenating single chars to multi char arrays
    By TJJ in forum C Programming
    Replies: 7
    Last Post: 11-20-2003, 04:09 AM

Tags for this Thread