nullptr 167 Occasional Poster

You've almost got it right.
Note that it should be int main() and pausing at line 35 achieves nothing.

Here's your code with some corrections.

#include <iostream>

using namespace std;

int lastLargestIndex(int [], int);

int main()
{
    int arr[15] = {5,198,76,9,4,2,15,8,21,34,99,3,198,13,61,};
    int location = lastLargestIndex(arr, 15);

    if (location != -1)
        cout << "The last largest index is: " << location << endl;

    // pause to read the output
    cout << "\npress Enter to exit...";
    cin.get();

    return 0;
}

int lastLargestIndex(int arr[], int size)
{
    if (size == 0)
        return -1;

    if (size == 1)
        return 0;

    // set variables to the first index
    int lastLargestIndex = 0;
    int tem = arr[0];

    // start the loop from the 2nd index (1)
    for (int i = 1; i < size; ++i)
    {
        if (arr[i] >= tem) // note >= so we get the last occurrence
        {
            lastLargestIndex = i;
            tem = arr[i];
        }
    }

    return lastLargestIndex;
}
nullptr 167 Occasional Poster

Refer to http://www.cplusplus.com/reference/cstdio/fgets/

A newline character makes fgets stop reading, but it is considered a valid character by the function and included in the string copied to str.

nullptr 167 Occasional Poster

registers(d) returns a char* so it returned %ebp

It could well be as Tumlee suggested.
If registers(d) is already returning %ebp, then you only need printf("%s", registers(d))

nullptr 167 Occasional Poster

What compiler are you using?
Seeing as printf("%%%s", registers(C)) isn't working as expected, you may need to resort to a workaround like printf("%s%s", "%", registers(C))

nullptr 167 Occasional Poster

Change lines 22 and 27 to match the function prototypes in lines 10 and 11.
You need to pass the correct variable name to each function.
e.g. displayArrayVal1( x_array);

The printf lines need fixing to something like:
printf("X-array1 = %u\n", x[0]);

nullptr 167 Occasional Poster

Try changing line 45 of the code I previously posted to:
if ( clock() > (GameAvailTMR + 100) )

nullptr 167 Occasional Poster

Personally, I find the wording of the question somewhat ambiguous. Hopefully this will help you.

#include <iostream>

using namespace std;

int main()
{
    int posCount = 0;
    int negCount = 0;
    int posSum = 0;
    int negSum = 0;
    int numb;

    cout << "Please enter any combination of ten positive\nor negative integers separated by whitespace, then press Enter:\n";
    for (int i = 0; i < 10; i++)
    {
        cin >> numb;
        if ( cin.fail() )
        {
            cin.clear();
            cin.ignore(90, '\n');
            --i;
            continue;
        }

        if ( numb > 0)
        {
            ++posCount;
            posSum += numb;
        }
        else
        {
            ++ negCount;
            negSum += numb;
        }
    }
    // simple input stream flush
    cin.ignore(90, '\n');

    cout << "\nThe sum of all positive integers = " << posSum << endl;
    cout << "The sum of all negative integers = " << negSum << endl;
    cout << "The sum of all integers = " << posSum + negSum << endl;
    // calculate the rest

    cout << "\n\npress Enter to exit...";
    cin.get();

    return 0;
}
nullptr 167 Occasional Poster

main.cpp(51): error C2664: 'FindWindowW' : cannot convert parameter 2 from 'LPCSTR' to 'LPCWSTR'

Either check your project properties that you're using the Multibyte character set and not Unicode, or change that call to FindWindowA. Seeing as everything else in the project isn't unicode, I'd go for the first option.

Also, to open, read and write the memory of a process other than your own you'll need SeDebugPrivilege.

nullptr 167 Occasional Poster

You really should be checking the return value of ReadProcessMemory, WriteProcessMemory etc. Here's your code minus the spelling mistakes and the obvious syntax errors. I've no idea if it works, I've not completely cleaned it up, but it does compile.

#include <iostream>
#include <Windows.h>
#include <string>
#include <ctime>

DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets [], DWORD BaseAddress);
void WriteToMemory(HANDLE hProcHandle);


std::string GameName="AssaultCube";
LPCSTR LGameWindow="AssaultCube";
std::string GameStatus;

bool IsGameAvail;
bool UpdateOnNextRun;

//AMMO VARS
bool AmmoStatus;
BYTE AmmoValue [] = {0XA3, 0X1C, 0X0, 0X0};
DWORD AmmoBaseAddress = 0x004DF73C;
DWORD AmmoOffsets[] = {0x378, 0x14, 0x0};

//HEALTH VARS
bool HealthStatus;
BYTE HealthValue [] = {0x39, 0x5, 0X0, 0X0};
DWORD HealthBaseAddress = 0x004DF73C;
DWORD HealthOffsets[] = {0xF4};



int main() //on startup
{
    HWND hGameWindow = NULL;
    int timeSinceLastUpdate = clock();
    int GameAvailTMR = clock();
    int onePressTMR = clock ();
    DWORD dwProcID = NULL;
    HANDLE hProcHandle = NULL;
    UpdateOnNextRun = true;
    std::string sAmmoStatus = "OFF";
    std::string sHealthStatus = "OFF";

    while(!GetAsyncKeyState(VK_INSERT))
    {
        if ( clock() == (GameAvailTMR > 100) )
        {

            GameAvailTMR = clock ();
            IsGameAvail = false;

            hGameWindow = FindWindow(NULL, LGameWindow);
            if(hGameWindow)
            {

                GetWindowThreadProcessId(hGameWindow, &dwProcID);
                if (dwProcID !=0)
                {
                    hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcID);
                    if(hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL)
                    {
                        GameStatus = "Failed to open process for handle value...Too Bad you didn't buy the warranty cause this ain't workin";
                    }
                    else
                    {
                        GameStatus = "I Hope your ready to start hacking";
                        IsGameAvail = true;
                    }
                }
                else
                {
                    GameStatus = "You Broke it...Nah just kidding, Failed to get proccess id, Check the …
nullptr 167 Occasional Poster

line 12 while ( k <= 0)
This condition is only met when k = 0.

line 14 j=3;
This is out of bounds for your matrix, valid values are 0 to 2 inclusive.

line 16 Image1[i][k]= Image2[j][k];
This is the wrong way around. You're just copying memory junk from Image2 to Image1.

nullptr 167 Occasional Poster

' ' is the space character which equals 0x20 or 32 in decimal.
The rest of the code is explained here > http://www.cplusplus.com/articles/1AUq5Di1/

Asmaa_2 commented: thanks alot for the link and your help :) +0
nullptr 167 Occasional Poster

If they turn off broadcasting of the SSID from the router, then only wireless connections configured with that SSID and the security passphrase (key) will 'see' the SSID. Any other wireless connection will just see something like 'Unknown network'.

nullptr 167 Occasional Poster

Use std::getline(cin, deleteMovie);
At present, if you entered 'when i met your mother(2009)', only 'when' would be read into deleteMovie. The behaviour you see after that is because the input stream isn't empty. Refer to http://www.daniweb.com/software-development/cpp/threads/90228/flushing-the-input-stream

Also, remove the calls to main() from your switch cases. Never use recursive calls to the programs entry point as a way of looping.

nullptr 167 Occasional Poster

Use std::getline, at present when you have cin >> name, if the entered name is M John then only M will be read into the name, for information on why your program then terminates refer to http://www.daniweb.com/software-development/cpp/threads/90228/flushing-the-input-stream

nullptr 167 Occasional Poster

There's most likely some memory junk in the upper 16 bits of the ebx register,
so change mov bx,1 to mov ebx,1

jannesb1 commented: correct +0
nullptr 167 Occasional Poster

See the comments I added to your display function.

void display()
{
    ifstream ofile("abc.txt");
    string bookname;
    string publisher;
    string author;
    int copies;
    int price;
    int edition;

    // none of this will display anything from abc.txt
    // as nothing from abc.txt has been read.
    cout<<" Book Name: "<<bookname<<endl;
    cout<<" Publisher Name: "<<publisher<<endl;
    cout<<" Author Name : "<<author<<endl;
    cout<<" No. Of Copies: "<<copies<<endl;
    cout<<" Price: "<<price<<endl;
    cout<<" Book Edition: "<<edition<<endl;


    // this is where you read abc.txt, but you're not formatting the output
    // so it will display as one contiguous jumble of book details
    while (ofile>>bookname>>publisher>>author>>copies>>price>>edition)
    {
        cout<<bookname<<publisher<<author<<copies<<price<<edition;
    }
    ofile.close();
}

Just move the formatting to inside the while loop.

    while (ofile>>bookname>>publisher>>author>>copies>>price>>edition)
    {
        cout<<" Book Name: "<<bookname<<endl;
        cout<<" Publisher Name: "<<publisher<<endl;
        cout<<" Author Name : "<<author<<endl;
        cout<<" No. Of Copies: "<<copies<<endl;
        cout<<" Price: "<<price<<endl;
        cout<<" Book Edition: "<<edition<<endl<<endl;
    }

It would also be a good idea to check whether abc.txt is actually opened.

    ifstream ofile("abc.txt");
    if (!ofile.is_open() )
    {
        // error opening file, handle error
        return;
    }
nullptr 167 Occasional Poster

long int - 4 bytes
char/unsigned char - 1 byte
float - 4 bytes
double - 8 bytes

The same for x64.

nullptr 167 Occasional Poster

The simple reason for the error is that the scope in which BankAccount b1 is valid, ends with the closure of your if (input == "y") block.

Here's your code with a few minor alterations.

class BankAccount
{
    protected:
        double balance;

    public:
        BankAccount()
        {
            balance = 0.0;
        }

        BankAccount(double b)
        {
            balance = b;
        }

        void Deposit(double b)
        {
            balance += b;    
        }

        double getBalance()
        {
            return balance;
        }
};

int main()
{
    BankAccount b1; // default constructor called
    string input;
    double bal;

    cout <<"Do you want to create an account (y/n) ?"<<endl;
    cin >> input;

    if(input == "y")
    {
        cout <<"\nYour account has been created !"<<endl;
        cout <<"Specify your amount to deposit :"<<endl;
        cin >> bal;

        b1.Deposit(bal);
        cout << "Your initial balance is : "<< b1.getBalance() << "." << endl;
    }
    cin.ignore(90, '\n');
    getchar();

    return 0;
}

I'll leave it to you to handle the precision of the displayed double variables. What happens if I deposit or open an account with a negative amount of money? It's a good idea to validate any user input, so take that into consideration when you're coding.

nullptr 167 Occasional Poster

You could also handle invalid input like this:

    unsigned short int x;
    bool flag = false;
    cout << "Enter an integer that I will reverse i.e. 301 --> 103" << endl;

    while (!flag)
    {
        cin >> x;
        if (cin.fail() )
        {
            // clear error flags and flush input
            cin.clear();
            cin.ignore(90, '\n');
            cout << "Invalid input, enter another integer" << endl;
            continue;
        }

        flag = true;
    }
    cout << reverse_num(x);
    cout << endl;
nullptr 167 Occasional Poster

I gather you did something like (just a simple example):

#include <iostream>
#include <string>

using std::string;
using std::cout;
using std::endl;

struct XML_Params{
    string name;
    float version;
};

/* passing the instance of XML_Params */
int output(const XML_Params& params)
{
    // if something goes awry
    // return a non zero value to signify an error
    cout << params.name << " - " << params.version << endl;
    return 0;
}

int main()
{
    XML_Params xparams;
    memset(&xparams, 0, sizeof(XML_Params));
    xparams.name = "blooper";
    xparams.version = 3.142;

    int iret = output(xparams);
    if (iret != 0)
    {
        //handle error
    }

    getchar();

    return 0;
}

If there's nothing further, then mark the thread as solved. :)

nullptr 167 Occasional Poster

You're variables are being filled in the scope of main(), so once you call output() those variables are no longer in scope.

The 'dirty' solution would be to declare the variables as global variables. A cleaner way would be to define a struct to hold the variables, fill the struct and pass either the struct instance or pointer to the output function.

nullptr 167 Occasional Poster

Not possible. Line 27 is wrong, as I explained in my last post. open() doesn't take a std::string as the first argument, it takes only char*.

This was discussed in this thread. and is possible, though I can't vouch for every compiler accepting a std::string as the file name.

This entire section of code is quite a mess.

cout << "Enter Student ID (999 to end): "; 
cin >> searchId;
inFile.open(file + ".txt");
inFile.ignore(80, '\n');
while (searchId != 999)
{
    for (int i = 0; i <= count; i++)
    {
        inFile >> ID >> lastName >> firstName >> q1 >> q2 >> q3 >> q4 >> final;
        if (searchId == ID)
        {
            avgGrd(q1, q2, q3, q4, final, average, grade);
            cout << " " << left << setw(12) << lastName << " " << setw(12) << firstName << ' '
            << setw(3) << average << ' ' << setw(2) << grade << endl;
            cout << "Enter Student ID (999 to end): "; cin >> searchId;
        }
    }cout << "Record not found!" << endl;
}cout << "Enter any character: "; 

cin >> end;

What constitutes a valid Student ID?
cin >> searchId;
Validate that searchId falls within the acceptable range.

If (searchId == 999) 
    return 0;

Also change void main() to int main()

inFile.open(file + ".txt");
check that you actually opened the file and handle if unsuccessful

Get rid of the following loops.
while (searchId != 999) and for (int i = …

nullptr 167 Occasional Poster

Apart from mike_2000_17 suggestions, another alternative would be to use a launcher for your application.
launcher.exe which doesn't rely on the possibly missing dll, checks for the dll and if not found issues the error message and exits, otherwise it launches the main executable.

You could even embed the main executable as a resource of launcher, so if the dll is present and the main executable hasn't yet been written to disk, it just writes the resource exe to disk and then launches it.

nullptr 167 Occasional Poster
bool containsVowel (string s) 
{
    if (0 == s.length())
        return false;

    if ( (s.substr(0,1)=="a") || (s.substr(0,1)=="e") || (s.substr(0,1)=="i") ||
        (s.substr(0,1)=="o") || (s.substr(0,1)=="u") ) 
        return true;

    return containsVowel (s.substr(1, s.length() - 1));
}

I'll leave you to work out handling uppercase vowels.

nullptr 167 Occasional Poster

Something like this?

struct person {
        string first;
        string last;
        string addr;
        string phone;
};

int main ()
{
    vector<person> pvec;
    person tp;

    tp.first = "Rhino";
    tp.last = "Neil";
    tp.addr = "22 Acacia Avenue";
    tp.phone = "5554646";

    pvec.push_back(tp);

    tp.first = "Orson";
    tp.last = "Cart";
    tp.addr = "Some Place, Unknown";
    tp.phone = "5551212";

    pvec.push_back(tp);

    for (person p : pvec)
        cout << p.first << " " << p.last << " - " << p.addr << " - " << p.phone << endl;

    cout << endl << "press Enter to exit...";

    cin.get();

    return 0;
}
nullptr 167 Occasional Poster

This should work.

int main ()
{
    double lat1;
    double long1;
    double lat2;
    double long2;
    double latz;
    double longz;
    double c = 0;
    double distance = 0;
    double x = 0;


    cout << "enter latitude 1 " << endl;
    cin >> lat1;
    cout << "enter longitude 1 " << endl;
    cin >> long1;
    cout << "enter latitude 2 " << endl;
    cin >> lat2;
    cout << "enter longitude 2 " << endl;
    cin >> long2;

    lat1 = lat1 * (pi/180);
    long1 = long1 * (pi/180);
    lat2 = lat2 * (pi/180);
    long2 = long2 * (pi/180);
    // already radians
    latz = lat2 - lat1;
    longz = long2 - long1;

    x = pow(sin(latz/2), 2.0) + cos(lat1) * cos(lat2) * pow(sin(longz/2), 2.0);

    c = 2 * atan2(sqrt(x), sqrt(1 - x)); 

    distance = 6371.009 * c; //distance in km

    cout << "Distance is: " << distance <<"km" << endl;

    cin.ignore(90, '\n');

    getchar();

    return 0;
}
nullptr 167 Occasional Poster

The second pow function has no exponent.

I thought this at first, but if you look closer you'll realise that it does.

On line 42. a = sqrt(x);
What is the purpose of a and where should it be used? (line 43?)

NathanOliver commented: Nice catch. +10
nullptr 167 Occasional Poster

I just realised that I messed up slightly in the above example. The fixed code is as follows.

bool add2intArray(unsigned char* iarray, int number)
{
    int index = number >> 3;
    unsigned char bit_value = 1 << (number & 7);

    if ((iarray[index] & bit_value) == bit_value)
        return false;

    iarray[index] |= bit_value;

    return true;
}

int main()
{
    const int size = 1000000/8;
    unsigned char arr[size] = {0};

    int test[ ] = {1 , 2, 8, 9, 7, 3, 203, 9, 999999, 2, 16, 54, 54, 99, 4, 6, 2, 9, 97, 8, 98, 999999, 999991};

    for (int i : test)
    {
        if (add2intArray(arr, i))
            std::cout << i << ", ";
    }

    getchar();

    return 0;
}

Write an EFFICIENT program that reads in the name of a file containing positive integers that are less than 1,000,000. The program prints out the integers in the file, in the order that they appear, eliminating duplicates. So if the file contained 8 3 1 9 2 8 15 9 8 4, the program would print 8 3 1 9 22 15 4.

The way I read the question, you simply need to read the file and print the content minus any duplicate values. There's no need to then save the non-duplicate list back to a file.

nullptr 167 Occasional Poster

Here's a fairly memory efficient example. The idea is basically to create an array where each bit in the array represents an integer. If the bit representing that integer is set then the function returns false, otherwise it sets the corresponding bit and returns true.

bool add2intArray(unsigned int* iarray, int number)
{
    int index = number >> 3; // same as number / 8
    unsigned char bit = number & 7;

    if ((iarray[index] & 1 << bit) == 1 << bit)
        return false;

    iarray[index] |= 1 << bit;

    return true;
}

int main()
{
    const int size = 1000000/8 + 1;
    unsigned int arr[size] = {0};

    int test[ ] = {1 , 2, 8, 9, 7, 3, 203, 9, 2, 16, 54, 54, 99, 4, 6, 2, 9, 97, 8, 98};

    for (int i : test)
    {
        if (add2intArray(arr, i))
            std::cout << i << ", ";
    }

    getchar();

    return 0;
}
nullptr 167 Occasional Poster

Number of integers = max_num - min_num + 1; // = 4
// 1/2 * 4 * (2 + 5) = 14

nullptr 167 Occasional Poster

The name strings should be "Jon" and "Bill" so I'm surprised it compiles.
Without knowing anything about your classes, it's difficult to comment further.

nullptr 167 Occasional Poster

Revised pseudo code:

bool isHeap (int* x, int n, int i) 
{
    for (int j = i; j < n; j++) 
    {
        if (!(first child exists))
            break;
        if (x[j] < x[first child])
            return false;
        // if no second child, there'll be no
        //  first child in the next loop, so break
        if (!(second child exists)) 
            break;

        if (x[j] < x[second child])
            return false;
    }

    return true;
}
nullptr 167 Occasional Poster

This can be further optimized because if x[j] has no first child, then obviously on the next loop x[j + 1] would have no children. So you can just break if the first child doesn't exist.

if (!first child exists)
    break;
else
{
    if (x[j] < x[first child])
        return false;
    if (second child exists)
    {
        if (x[j] < x[second child])
            return false;
    }
}
nullptr 167 Occasional Poster

The function returns true if the HEAP property holds among the array elements x[i]...x[n-1] , and false otherwise. The HEAP property is simply that for every value of j between i and n-1 , x[j] is not less than its heap children if they exist. (The heap children of x[j] are x[2j+1] and x[2j+2] .

So basically x[j] can have 0, 1 or 2 children. If it has no children, then there's nothing to cause a HEAP property failure. For code efficiency, there's no reason to check for a second child unless x[j] has a first child and the HEAP property holds true for the first child.

So with that in mind, the 'pseudo' code would look like:

bool isHeap (int* x, int n, int i) 
{
    for (int j = i; j < n; j++) 
    {
        if (first child exists)
        {
            if (x[j] < x[first child])
                return false;

            if (second child exists) 
            {
                if (x[j] < x[second child])
                    return false;
            }
        }
    }

    return true;
}
nullptr 167 Occasional Poster

In class Tree you have a constructor defined but no implementation for it.

class TREE
{
public:
    NODE * headLeaf;
    NODE * getmin();
    void Binary(NODE *);
    void Create();
    void Insert(unsigned char);
    void printTree(NODE * n);
    TREE();         // <-- constructor with no implementation

edit: deceptikon beat me to it. :)

nullptr 167 Occasional Poster

This should work for you. Note that you have only 3 choices so there's no need for
else if (compchoice == 2). As it's the only remaining condition, you can simply have else

int main()
{
    srand ( time(NULL) );
    int choice;
    int compchoice;
    int winCount = 0;

    //Creating the interface
    cout << "Welcome to the Rock, Paper, Scissors game." << endl;

    do
    {
        cout << " 1 = Rock, 2 = Paper, 3 = Scissor, 4 = Exit Program" << endl;

        compchoice = rand() % 3;
        cin >> choice;
        // flush input stream
        cin.ignore(90, '\n');

        if (choice == 1) 
        {
            if (compchoice == 0)
                cout << "It's a tie!\n\n\n\n";
            else if (compchoice == 1)
                cout << "Paper beats rock! Sorry, you lose!\n\n\n\n";
            else //if (compchoice == 2)
            {
                cout << "Rock beats scissors! You win!\n\n\n\n";
                winCount += 1;
            }
        }

        if (choice == 2)
        {
            if (compchoice == 0)
                cout << "It's a tie!\n\n\n\n";
            else if (compchoice == 1)
            {
                cout << "Paper beats rock! You win!\n\n\n\n";
                winCount += 1;
            }
            else //if (compchoice == 2)
                cout << "Scissors beat paper! Sorry, you lose!\n\n\n\n";
        }

        if (choice == 3)
        {
            if (compchoice == 0)
                cout << "It's a tie!\n\n\n\n";
            else if (compchoice == 1)
            {
                cout << "Scissors beat paper! You win!\n\n\n\n";
                winCount += 1;
            }
            else //if (compchoice == 2)
                cout << "Rock beats scissors! Sorry, you lose!\n\n\n\n";
        }

        if (choice == 4)
        {
            return 0;
        }

    } while (winCount < 3);

    cout << "You won three …
nullptr 167 Occasional Poster

Can you post the complete code you now have? What do you want to happen if you lose to the computer?

nullptr 167 Occasional Poster

For compchoice you want values of 0 to 2 inclusive. At present you have compchoice = (rand()%2)+1;
meaning compchoice will either be 1 or 2.

Change it to compchoice = rand() % 3;

nullptr 167 Occasional Poster

In line 65 you've got return main(), that's part of the problem. You should never recursively call the entry point of a program.

The do/while loop should look like:

do
{
    // calculate compchoice
    // cin >> choice
    // process data

} while (winCount < 3);

After that you'd display the win message, pause execution of the program so the message can be read and finally return 0;

nullptr 167 Occasional Poster

Edit:

    while (count < num) {
        sum += a[count];
        ++count;
        average=sum/num; // 
    }

That should actually work, though it's not optimal because average is being calculated every time you loop through the array, though the result only becomes valid on the final loop.

nullptr 167 Occasional Poster

The major reason that your tableAverage function fails is because the average is being calculated inside the loop that iterates through the array.

    while (count < num) {
        sum += a[count];
        ++count;
        average=sum/num; // this should not be inside the loop
    }

You also declare float average when infact you want a double. There's really no reason to declare a variable for average either. Just follow deceptikon's previous advice for the tableAverage.

int tableMatchingElements(double a[], int num, double average)
{
    int ct = 0; // to hold the count of matching elements

    // loop through the array
    for (int i = 0; i < num; ++i)
    {
        if (a[i] == average)
        {
            ++ct;
        }
    }

    return ct;
}

int equal = tableMatchingElements(table, n, average);
printf("There are %d values equal to the average.\n", equal);

The other functions are basically the same as tableMatchingElements(...), except for where you compare a[i] to the average.
e.g for greater

    if (a[i] > average)
    {
        // TODO print value of a[i]
        ++ct;
    } 
nullptr 167 Occasional Poster

Where's your code for the assignment?

nullptr 167 Occasional Poster

I think you'll find that what you want is the DOT11_SSID member of the WLAN_AVAILABLE_NETWORK struct.

anukavi commented: Thanks and this worked. U have helped me a lot and have also learnt lot by making errors.Thanks friend +0
nullptr 167 Occasional Poster

Set the PlainText property to false, then
RichEd.Lines.SaveToFile('...\blah.rtf');
or use a TMemoryStream not a TStringStream.

nullptr 167 Occasional Poster
nullptr 167 Occasional Poster

I'm not sure if this is what you mean, but try printf("How are you %%dad%%");

nullptr 167 Occasional Poster

Try calling UpdateWindow after you call .put_Text("Waiting...")

nullptr 167 Occasional Poster

Also line 20 else { int main() ; }
This is another function prototype, though even if you wrote:

else
{
    main();  // recursive call to main
}

Recursively calling main() should not be done.

In function: int area() you may as well change it to void area() as you are not returning any result of the function.
So either change to return; or you can omit the return

nullptr 167 Occasional Poster

(*string <= '9' && *string >= '0')
In hexadecimal this translates to *string <= 0x39 && *string >= 0x30

*string - '0'
Assume the number is 8, therefore *string would be in hex 0x38.
So 0x38 - 0x30 = 8

You could also use:
value = (value * 10) + (*string ^ 0x30);

BTW. The code posted won't work for a negative integer because it doesn't account for the - sign. It also should trim any leading whitespace and preferably check for overflow.

nullptr 167 Occasional Poster