nullptr 167 Occasional Poster

From the screen shot you posted above, it appears that the size of an unsigned long is only 16 bits (2 bytes) for the Turbo compiler you have.
Therefore, when you entered hex: 233AC it was truncated to two bytes 33AC = 13228 decimal.

nullptr 167 Occasional Poster

Comment it out to make sure that it fixes the display problem. If everything is OK, then delete it if you like.

nullptr 167 Occasional Poster

Comment out line 123: printf("%c\n", hex16[i16]);

nullptr 167 Occasional Poster

Follow Schol-R-Lea's advice regarding fixing the conversion functions.
For the code you posted above, remove the do while loop from void Screen_Header() and simplify it to:

void Screen_Header()
{
    clrscr();
    gotoxy(1,3);
    printf("Conversion from any base to base 10");

    gotoxy(1,5);
    printf("a - Binary");

    gotoxy(1,6);
    printf("b - Octal");

    gotoxy(1,7);
    printf("c - Hexadecimal");

    gotoxy(1,11);
    printf("Select a base to be converted: ");

    scanf("%c", &base);
    switch(base){
    case 'a':
        Binary2Decimal();
        break;
    case 'b':
        Octal2Decimal();
        break;
    case 'c':
        Hexa2Decimal();
        break;
    }
}

Then put the do while loop and prompts to continue into the main function:

int  main()
{
    do {
        Screen_Header();

        fflushStdin();

        printf("Press <ENTER> to Continue or Press <ANY KEY> to Exit ");

    } while (_getch() == '\r');

    return 0;
}
nullptr 167 Occasional Poster

My contribution: The lady played the piano with broken legs.

nullptr 167 Occasional Poster

@Solomon bekele, do not hijack someone elses thread. Please start your own thread and provide the code you have written so far.

@neyoibarra, have a look at the functions referenced at http://www.cplusplus.com/reference/cctype/

or if he tries to press a number nothing will come up on the program, almost as if saying in a way that i turned off the specific keys.

Is this to do with your previous post on entering a password? If it is, could you show the code that you currently have, along with the specific restrictions you wish to implement?

nullptr 167 Occasional Poster

It should be itemtype::itemtype() (case sensitive)

nullptr 167 Occasional Poster

Here's some code I threw together that demonstrates what you're looking to do.

int main()
{
    using std::cout;
    using std::endl;
    using std::cin;

    const int bufsize = 100;
    const int max_pwd = bufsize - 1;
    char password[bufsize]; // = {0};
    password[0] = '\0';

    cout << "Enter the password: ";
    for (int i = 0; i < max_pwd; ++i)
    {
        int ch = _getch();

        if (ch == '\r')
        {
            // null terminate the password
            // output the line break and exit loop
            password[i] = '\0';
            cout << endl;
            break;
        }

        if (ch == '\b')
        {
            if (i > 0)
            {
                password[i] = '\0';
                // overwrite the previous character
                cout << "\b \b";
                i -= 2;
            }
            else
            {
                password[i] = '\0';               
                --i;
            }
        }
        else
        {
            password[i] = ch;
            cout << "*";
        }
    }

    cout << password << endl;

    cout << "\npress Enter to exit...";

    cin.get();

    return 0;
}
nullptr 167 Occasional Poster

Are you calling SendInput like this:

    int screen_x = GetSystemMetrics( SM_CXVIRTUALSCREEN );
    int screen_y = GetSystemMetrics( SM_CYVIRTUALSCREEN );

    INPUT input = {0};
    input.type = INPUT_MOUSE;
    input.mi.dx = (x * 65535) / screen_x;
    input.mi.dy = (y * 65535) / screen_y;
    input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;

    UINT ret = SendInput( 1, &input, sizeof(INPUT) );
nullptr 167 Occasional Poster
nullptr 167 Occasional Poster

Try running scans with AdwCleaner and Junkware Removal Tool.
Post back if these don't get rid of it.

nullptr 167 Occasional Poster

Go to %windir%\logs\cbs\cbs.log and see if you can copy/paste the log to your desktop.
If successful try again with command:
findstr /c:"[SR] Cannot" "%userprofile%\Desktop\cbs.log" >"%userprofile%\Desktop\sfcdetails.txt"

nullptr 167 Occasional Poster

It's likely that MSE accessed the file, blocking you from reading it. Try temporarily disabling MSE protection, then open a new elevated cmd prompt and try again.

nullptr 167 Occasional Poster

And the command prompt said corrupt files found and fixed no errors.

Open an elevated command prompt as before and paste in the following:
findstr /c:"[SR] Cannot" %windir%\logs\cbs\cbs.log >"%userprofile%\Desktop\sfcdetails.txt"

If the sfcdetails.txt saved to your desktop isn't an empty file, attach it to your post. Hopefully this will show how much file corruption there is.

nullptr 167 Occasional Poster

The latest Java JRE version is 7 Update 45, uninstall all older versions from Programs and Features.
Java 7 Update 25
Java 7 Update 40

Download the updated version (if needed) from http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html

Run OTL, paste the content of the following code box into the main window, then click Run Fix. (double click in the code box to select all, then right click copy)

:OTL
O2 - BHO: (no name) - {5C255C8A-E604-49b4-9D64-90988571CECB} - No CLSID value found.
O3:64bit: - HKLM\..\Toolbar: (no name) - {ae07101b-46d4-4a98-af68-0333ea26e113} - No CLSID value found.
O3:64bit: - HKLM\..\Toolbar: (no name) - Locked - No CLSID value found.
O3 - HKLM\..\Toolbar: (no name) - Locked - No CLSID value found.
O3 - HKCU\..\Toolbar\WebBrowser: (no name) - {2318C2B1-4965-11D4-9B18-009027A5CD4F} - No CLSID value found.
O3 - HKCU\..\Toolbar\WebBrowser: (no name) - {7FEBEFE3-6B19-4349-98D2-FFB09D4B49CA} - No CLSID value found.
O32 - AutoRun File - [2013/12/02 18:34:50 | 000,013,547 | ---- | M] () - C:\autoupdate.log -- [ NTFS ]

:Commands
[EMPTYFLASH]
[EMPTYJAVA]
[EMPTYTEMP]

Reboot your PC if it doesn't automatically do so. Post the log.
Go to start menu -> all programs -> accessories -> right click on command prompt and Run as administrator.
At the command prompt, type in SFC /SCANNOW press Enter. Let me know if it finds any errors that can't be fixed.

nullptr 167 Occasional Poster

There's a bit of junk to remove and outdated java to uninstall. Also Skype seems to be corrupted.
Download OTL and save it to your desktop. Click on Run Scan.
When it has finished, there'll be 2 logs created. Attach the logs to your post.

nullptr 167 Occasional Poster

Just click on the paperclip in the toolbar and attach the DDS logs.

nullptr 167 Occasional Poster

Have you run the scans with JRT and DDS?

Running services, microsoft management console stops responding.

I'll look at this once I see your logs.

nullptr 167 Occasional Poster

it tells me to make sure windows is up to date and I have no idea where to update it since I cant seem to from my computer.

Do you mean that Windows Update will not run?

Run Junkware Removal Tool, reboot, then run DDS. Run another scan with RogueKiller, then post the logs from all scans.

nullptr 167 Occasional Poster

Re-scan with RogueKiller and have it remove everything except:

[HJ SMENU][PUM] HKCU[...]\Advanced : Start_ShowMyPics (0) -> FOUND
[HJ SMENU][PUM] HKCU[...]\Advanced : Start_ShowMyMusic (0) -> FOUND
[HJ DESK][PUM] HKLM[...]\NewStartPanel : {59031a47-3f72-44a7-89c5-5595fe6b30ee} (1) -> FOUND
[HJ DESK][PUM] HKLM[...]\NewStartPanel : {20D04FE0-3AEA-1069-A2D8-08002B30309D} (1) -> FOUND

If you intentionally disabled System Restore, then uncheck:

[HJ][PUM] HKLM[...]\Wow6432Node[...]\SystemRestore : DisableSR (1) -> FOUND

Reboot - MSE + Malwarebytes should be able to run.

nullptr 167 Occasional Poster

Warm today and hotter tomorrow, around 35°C in Sydney Australia.

nullptr 167 Occasional Poster

Read this.

nullptr 167 Occasional Poster

Try using FormatSettings.LongMonthNames[12]. I assume you declared S as a String.

nullptr 167 Occasional Poster

This sounds like a ZeroAccess infection. Run a scan with RogueKiller and post the log file.
For 32 bit OS - http://www.adlice.com/softs/roguekiller/RogueKiller.exe
For 64 bit OS - http://www.adlice.com/softs/roguekiller/RogueKillerX64.exe

Also post the log from Malwarebytes as suggested in the above post.

nullptr 167 Occasional Poster

Would something like the following fit the requirements?

    std::string str = "455454554";
    std::cout << "*-" << str.substr(str.size() - 4, std::string::npos) << std::endl;
nullptr 167 Occasional Poster

Are you guessing?
Check the op's code before you comment. goto line 12-16. What do you see?...

Also you provided nothing new and no solution to the op. Check first. ))

I assume you're addressing me?
1. No, I'm not guessing.
2. line 1: Expect to print values of arr[0] to arr[4]. So at lines 12 to 16 I see an obvious mistake.
3. I always check. I have no interest in posting for the sake of increasing my post count.

nullptr 167 Occasional Poster

cout << *static_cast<int*>(test);, in what way doesn't this print the int value "in a string way"?

imagine that int is 200, i want print 200, but in a string way

Do you mean that you want to store the int value in a std::string?

    int i = 12;
    void *test = &i;

    stringstream ss;
    string str;
    ss << *static_cast<int*>(test);
    ss >> str;
    cout << str << "\n";
nullptr 167 Occasional Poster

for_each(ptrList.begin(),ptrList.end(),[](int *c){ cout << *c-1;});

It should just be cout << *c, otherwise it's subtracting 1 from each value.
ie. -1, 9, 19 etc

for_each(ptrList.begin(), ptrList.end(), [](int *c){ 
    cout << *c << "\n";
});
nullptr 167 Occasional Poster

At line 12 you've declared an iterator: vector<int *>::iterator itr = ptrList.begin();
So just use it to iterate through the vector.

 vector<int *>::iterator itr = ptrList.begin();
 for( itr; itr < ptrList.end(); ++itr ) {
     cout << **itr << endl;
 }
nullptr 167 Occasional Poster

Line 17: cout << *itr << endl;
*itr is of type Integer, so what you want is the value member of class Integer
cout << static_cast<Integer>(*itr).value << endl;

nullptr 167 Occasional Poster

Refer to this MSDN article.

nullptr 167 Occasional Poster

Seeing as in this post you just copy/pasted from wiki answers, I suggest that you study and learn from what you posted. Once you do that, there'll be no reason to ask this question.

nullptr 167 Occasional Poster

The inner loop should be for (int j=i; j>0; j--)
Your logic is correct, though the sum will only apply for 1 + 2 + ... + 1039 = 540,280
ct1 could be written as:

    int ct1 = 0;
    for (int i = 0; i < 1040; ++i)
        ct1 += i;
nullptr 167 Occasional Poster

In Student class change setDate to:

void Student::setDate(Date x)
{
    this->birthdate = x;
}

Then in main() after setting the members of Date you need to call:

a[i].setDate(d);

I assume that checking for valid data wasn't a requirement. eg integer overflow, inputting a string etc

nullptr 167 Occasional Poster

Change void main() to int main()
On line 35. if(i<3), if i is >=3 then you'll never enter that section of code. I assume that what you want to do is to keep displaying the menu until 3 is chosen. An easy way to do this would be:

printf("\n\nMenu\n\n1.Union\n2.Intersection"); 
printf("\n3.exit"); 
printf("\nEnter your choice:\n");

while (scanf("%d", &ch) && (ch != 3))
{
    switch(ch) {
    case 1: 
        Union(a,b,m,n); 
        break; 

    case 2: 
        Intersection(a,b,m,n); 
        break; 

    default:
        printf("\nInvalid choice!");
        break;
    }
    printf("\n\nMenu\n\n1.Union\n2.Intersection"); 
    printf("\n3.exit"); 
    printf("\nEnter your choice:\n"); 
}

return 0;
nullptr 167 Occasional Poster

There's a work around that enables you to download and save the 8.1 ISO to external media. Details at http://www.neowin.net/news/here-is-how-to-get-the-windows-81-iso-and-create-a-usb-install-stick

nullptr 167 Occasional Poster

Post your code.

nullptr 167 Occasional Poster

line 17: Should be double sum = 0;
line 28: You can't return 2 parameters

#include <stdio.h>
#include <stdlib.h>

double average(int arrx[6], int *ptr);

int main(void){
    int arry[6]= {2, 5, 4, 5, 6, 7};
    int count = 0;
    double avg;

    avg = average(arry, &count);
    printf("The average is %.2f\n", avg);
    printf("The first number bigger than the average is %i", count);

    printf("\n\npress Enter to exit...");
    getchar();

    return 0;
}

double average(int arrx[6], int *ptr){
    int c = 0;
    double sum = 0;
    double a = 0;

    for(c = 0; c < 6 ; c++){
        sum = (double)sum + arrx[c];
    }
    a = sum/6;

    /* Set count to the first number greater than the average */
    for (c = 0; c < 6; c++){
        if(arrx[c] > a){
            *ptr = arrx[c];
            break;
        }
    }
    return a;
}
sing1006 commented: thx, you solve my problem by remind me can't return 2 parameters. +1
nullptr 167 Occasional Poster

Is there any way to retrieve?

Not this time.
To retain your tabs, go into CCleaner preferences and uncheck the Firefox preference 'Session'

nullptr 167 Occasional Poster

This tutorial explains the steps needed to link a simple MessageBox program.

nullptr 167 Occasional Poster

PhotoRec should be able to recover any files that are still intact.

nullptr 167 Occasional Poster
double totalSq=0, avg =0;
total += num;
totalSq+= (num-avg)*(num-avg);

In the second loop:
Isn't the declaration of double totalSq=0, avg =0; only in scope for this loop? Shouldn't these values just be initialised before the loop and const removed from the initial declaration of avg - double avg = static_cast<double>(total) / count ;
How is avg in this loop mean't to be calculated? At present its value will always be 0.

nullptr 167 Occasional Poster

line 72, 73: The delimiter should be a char not a string. ','

nullptr 167 Occasional Poster

Change all the for loops in your vCount function to be like:
for (int ii = 0; ii < vowelA; ii++) // < not <=

The same for line 65. for (int i = 0; i < nochar; i++)

nullptr 167 Occasional Poster

Using your above example for 1252345

n = 1252345
number = ""
chunk_count = 0

number = 1252345 % 1000 = 345 <- convert to string
n      = 1252345 / 1000 = 1252
number = three hundred forty five + number
       = three hundred forty five
chunk_count = 1

number = 1252 % 1000 = 252 <- convert to string
n      = 1252 / 1000 = 1
number = two hundred fifty two thousand + number
       = two hundred fifty two thousand three hundred forty five
chunk_count = 2

number = 1 % 1000 = 1 <- convert to string
n      = 1 / 1000 = 0
number = one million + number
       = one million two hundred fifty two thousand three hundred forty five
chunk_count = 3 // not used as n = 0, so loop exits.

chunk_count is just used as an index into the power_to_text array.
string power_to_text[] = { "", "thousand", "million", "billion" };

The variable declaration string number; assigns an empty string to variable number, so in essence number = ""

nullptr 167 Occasional Poster

the (i-1) in the second loop for(int n = 2; n <= i - 1; n++). What is the value of i??? and consequently what is the value of (i-1)?????

I gather that your nested loop in its entirety would be:

for (int i = 3; i <= num; i++)
{
    prime = true;

    for (int n = 2; n <= i - 1; n++)
    {
        if(i % n == 0)
            prime = false;
    }
}

The value of 'i' in the inner loop will correspond to what it currently is in the outer loop.
outer loop - for (int i = 3; i <= num; i++), 'i' will initially be 3 then increment by 1 until such time as its greater than num.

edit: yeah, what mike said

nullptr 167 Occasional Poster

I'll attempt to explain this by showing each iteration of the while loop.
int x = 125

loop 1: count = 1, x = (125/10) which = 12
loop 2: count = 2, x = 12/10 which = 1
loop 3: count = 3, x = 1/10 which = 0
loop ends as x = 0.
So number of digits = 3.
Remember as mike pointed out that this is integer division.

nullptr 167 Occasional Poster

With your current approach, you are actually making this far more difficult than it is.
There is no reason to use an array, all you need are two integer variables, one to hold the current input and the second to hold the sum.
Then you continue to take integer input and add it to the sum, until the integer entered is negative.
So thus far:

    int number = 0;
    int sum = 0;

    cout << "enter numbers:\n";
    while ((cin >> number) && (number >= 0))
    {
        sum += number;
    }

After that you need to flush the input stream, refer to this article for further information.
Just use cin.ignore(90, '\n'); for this program.
Then display the sum.

nullptr 167 Occasional Poster

You've already initialized count to zero, make sure you do the same for sum.
I've kept the outside while loop as is to maintain your assumption that the you need to check for eof and removed the unnecessary inner loop.

while ( !num_list.eof())
{
    num_list >> number;

    sum += number;       
    if (number % 2 == 0)
       ++even;  // increment even count
    else
       ++odd;   // increment odd count

    ++count;
    // check whether 50 numbers have been read.
    if (count == 50)
        break;
}

Now just write the sum and the count of even and odd numbers to file.

nullptr 167 Occasional Poster

Scan your system with MBAM, select Free version download.
Then try running ESET's online scanner.

Their may be some manual cleanup needed once the infection is removed.
Post back if you need further assistance and provide the scan logs.