Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Are you sure you are running Windows 8? That is still in beta testing.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This worked ok for me. Make sure the input file is in the same folder as the *.exe program


#include <iostream> #include <stdio.h> using namespace std; int main() { FILE* newf = NULL; newf = freopen("TextFile1.txt" ,"r+",stdin); if( newf == NULL) { printf("Can't reopen textfile1.txt\n"); return 1; } newf = freopen("bb.txt","w",stdout); if( newf == NULL) { printf("Can't reopen bb.txt\n"); return 1; } int x; cin>>x; cout << "x = "<<x<<endl; return 0; }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

After lie 13 set pos = 0

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You reopened (renamed) stdin to be a text file, therefore cin is getting the data from text file intead of keyboard. Check cin for errors. Also check that text file to see that it contains numeric digits, if it doesn't then cin will fail.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Welcome back. A lot has changed in the past week or so, so you might want to briefly look at some of the threads in DaniWeb Commnity Forum.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Why does including (float) make the difference?

Because 1/2 is integer digision, and 1 divided by 2 is 0. Make it float in a couple ways: 1) 1.0F/2.0F or 2) (float)1/2, or 3) 1.0F/2, or 4) 1/2.0F. Any of those methods are ok, just a matter of personal preference.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

also I did not receive any rep points from AD(twice) and Eagletalon when they commented on my post at the C, C++ and Windows forum even though they have a +14 and a +3 power to affect someone elses reputation

check to see if a comment was left -- no comment, no change to rep points. Its also possible it may have been my fault -- repping is still a bit confusing, I may have pressed the up arrow before adding the comment and I think you have to add the comment first.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is one of several text dictionaries

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The first thing you need to do is create that text file, unless your teacher gave you one. If you google around for dictionary text files you may be able to find one.

After that, write your program one small step at a time. you know that you have to ask the user for a word, so start out your program with just that informaton. Compile and get it working before moving on gto the next part of the assignment.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

worked for me on pyTony's post here, although it took a couple seconds for the 1 to appear.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'ts spelled "smilies" in the AD Directionary :) And yes, I realize its not a big deal, just put it near the bottom of your to-do list.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Almost right, the last parameter has to be multiplied by sizeof(int) to produce the correct number of bytes. The last parameter to memcpy() is in bytes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Dump that old ancient compiler and buggy IDE. Get either free VC++ 2010 Express or free Code::Blocks w/MinGW compiler. Both compilers will produce startup DLL projects for you.

Here is a tutorial

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your program worked perfectly for me using VC++ 2010 Express on Windows 7. since this is c++ code you don't need the typedef symbol.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you plan to support silies ? like :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'm happy to see that you fixed the bug that if you forget to add edit comments the editor erased everything you did :) :) Hurrey!!!

Now, if you would only not require comments for us normal folk.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

the easiest way to do it is to just copy everything from InputArray to OutputArray, then sort OutputArray. If you are allowed to use it you can copy the entire array with one line of code using memcpy() function. If you can't use that function then do the copy in a loop.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'm on IE9 now, and checking if I can post this.

[edit] ^^^ no problems.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

m1[10][10] = rand() % 10;

that is doing nothing but populating a single cell, which is NOT in the matrix, with a single random number. There is no such cell in that matrix.

if(r2==c1)

Huh? What difference does it make if r2 is the same value as c1? r2 is a row number in the matrix and c2 is a column number. The two values are unrelated.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Depends on the operating system. For MS-Windows see LogonUser win32 api function

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

use fgets() instead of scanf() so that all the words get put into the string.

int main()
{
   char line[100];
   fgets(line, sizeof(line), stdin);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It is showing you all the rows/columns that it populates. If you display them all then you will see that there are lots of cells that were not populated. Print them to a text file instead of on the screen so that you can easily see what cells were or were not populated.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The first thing I noticed is that this->name is an unallocated pointer (line 67, road.cpp). You have to allocate memory for it before you can call strcpy() in the second constructor.

line 7, main.cpp: missing the third parameter to the constructor.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

delete this if statement: if(arr[i][j] > 0){

and this one: if(arr[i][j] > 0){

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

#define sizes 1200



 main()
{
    double** arr;
    int m[sizes];
    int i,j,k;

    srand((unsigned)time(NULL));

    arr= (double **) calloc(sizes,sizeof(double*));
    for(k=0; k< sizes; k++){
    arr[k]=(double*)calloc(sizes,sizeof(double));
    }

    for(j=0; j< sizes; j++){        

        for(m[j] = 0; m[j] <30, m[j]++){
            i= (int) rand()%1200;
            arr[i][j]= (double) rand()/RAND_MAX
            printf("arr[%d][%d] = %lft", i, j, arr[i][j]);
            printf("n");
        }
    }
    // FREEING MEMORY        
  for (k = 0; k<sizes; i++)    {        
      free(arr[k]);        

  }   
    free(arr);  

    getch();

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Not sure what you are trying to accomplish with that code, but the reason that you don't see all the data is probably due to those two if conditions. Remove them and just set each element to some random number.

for(i = 0; i < sizes; i++)
{
    for(j = 0; j < sizes; j++)
        arr[i][j] = rand();
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I tried to compile the code you posted but it contains lots of errors. What compiler are you using? If yours doesn't produce errors then you either need a different compiler or set compiler to a higher warnig level. For example, line 40 the first parameter to merge() is merge_sort() but merge_sort() has a void return value so it will not return anything.

You have to fix all those compile errors before you can tell whether or not the code will work.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can easily check that if you just print out the contents of Packet_Request

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That's right -- this is supposed to be C, not C++. C uses pointers, not references. so you want createGeo(geo* inst), then replace . with ->, such as inst->coords[0+jump][j][0] = j;

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to tell us about the problems you are having. Would you take your car to a repair shop and tell the people "my car is broke, please fix it". Of course not, you have to explain as best you can what's wrong with your car. Same here. We can't help you if you won't let us.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It only works for numeric digits, anything else would be considered undefined behavior.

char c = '1';
int x = c - '0';
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

A common mistake with unexperienced programmers. You need to add a line at the end to keep the window open. For example you can call getchar() so that it will wait for you to hit a key before closing.

this may be a dumb question, but do you hit the <Enter> key after entering the three numbers? If not, the program will wait forever for that key.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

GLubyte indices[];

Declare that as a pointer and allocate memory for it on line 35, after you know how big it should be.

void createGeo(geo inst)

Pass that object by reference, not by value. such as void createGeo(geo& inst)so that any changes made by createGeo() are reflected in the object created in main()

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The number 48 is for the character '0' (zero), google for "ascii chart" and you will get a complete list. In the code you posted the -48 is converting a charcter digit '0' to '9' to binary, by subtracting '0' from it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you must still be quite sure that there is not any other pointers existing to the nodes

That should never happen, there shoul never be two nodes that have next pointers to the same node.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Post your program so that we can see what you tried to do. Its likely either 1) the propgram did not compile because of errors, or 2) the program just doesn't do what you thought it should do. But we won't know until you show us your program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The easiest way to do the swap is to swap the data, not the node itself. If you do that then there is no problem with pointers because they won't be changed. When a node has a lot of data items it is easier to put them into a structure so that the structure can easily be swapped. But in the OP's program there is only one int data item in the node so structure isn't necessary. Like I said, all you have to do is swap the int data item exactly like you would do if you were sorting a simple int array. Swapping nodes and adjusting all those pointers is just simply too much unnecessary work and headaches.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Any tutorial will depend on what compiler and operating system you are using. I just downloaded the source code and built using VC++ 2010 on Windows 7 and did not have any problems. The lib folder already contained project files that were needed and VC++ 2010 imported that project file with no problems.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I cant find any libcurl tutorial on the web.

Huh? That's odd because I found lots of them here

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Testing

~~
printf("%02d", "something");
~~

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This is what I have but it isn't working in the slightest..??

That program worked ok for me using VC++ 2010 Express on Windows 7. If its broken for you then I suspect that pheininger is correct in his assessment. Change int sixdigits to long sixdigits

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Code tags [code] [/code] don't work anymore. See the discussion in this tread

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Nevermind, guess I'm blind. I didn't see the submenu item to the left of Community Feedback.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

How can I get there without going through another post that's already in Area 51? I don't see a link anywhere for it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you want to put it into the first byte of ar[] then what you posted is ok. If you want to put it somewhere else then you have to tell the compiler where to put it, e.g. fread( &ar[i], 1, 1, fine);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This suggests that ofp might be NULL.

His program is already checking for that condition.

mitrmkar commented: Right - Indeed, it does. +13
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you want to convert "10" to 10 then you need to call one of the conversion functions, such as atoi()

printf("%d\n", atoi("10"));
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you get paid whenever I click one of the ads ? The reason I'm asking is because I want to decide whether to turn them off or not. Some of the ads seem to be worthwhile reading so if it will bring you more revenue then I might just leave the ads turned on.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Dani was kind enough to give the rest of us that ability. Any verified member can undo reputation.

Yes I can confirm that works for non-staff members because I tried it to test something else earlier today.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Setting yourself to invisible completely hides the fact that you even log in. This is by design. I kinda thought that vBulletin's invisible feature was a bit silly, because I could set myself to invisible and it would go out of its way to hide my Online/Offlne status in my profile, but two lins under that, it would say "Last Visit: 1 minute ago". My thoughts are that if someone wants to be Invisible, they don't want people to know they are on the site unless they post something.

If you go to my profile you will find that I have data in Today's Activity Points. Maybe that too should be hidden if your intention is to make invisibility mode completly invisible.