mojo666's Profile User Rating: -----

Reputation: 233 Stalwart
Group:
Expert
Active Posts:
549 (0.39 per day)
Joined:
27-June 09
Profile Views:
7,009
Last Active:
User is offline May 15 2013 02:39 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Mozilla
Favorite Processor:
Who Cares
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0
Expert In:
Computer Science

Latest Visitors

Icon   mojo666 has not set their status

Posts I've Made

  1. In Topic: INSERT SELECT with some values specified and others from OPENROWSET

    Posted 15 May 2013

    I think you can just add the variables to the SELECT.

    SELECT @ServiceId,@sourceCountryId, dest,peak,offpeak FROM OPENROWSET('Microsoft...
    


    Worth a shot at least.
  2. In Topic: C-Structure, linked list problem

    Posted 14 May 2013

    else
      {
        t1=(struct node *)malloc(sizeof(struct node));
    
      printf("\nEnter index number:\t");
      scanf("%d",&t->index);
       printf("\nEnter Name:\t");
        scanf("%s",&t->name);
        printf("\nEnter Sex:\t");
        scanf("%s",&t->sex);
            printf("\nEnter age:\t");
        scanf("%d",&t->age);
        t1->next=t->next;
        t->next=t1;
        t=t1;
                                                                                             
    }
    
    


    Shouldn't you be setting the properties of t1 instead of t? You are currently overwriting whatever is at t, then adding the unitialized t1 at the end of the list.

    case 3:
         ////////////////////// remove by index and by name
        printf("Enter index number of person to be deleted=\n");
        scanf("%d",&index_del);
        t=h;
     while(t->index!=index_del)////////////////////breaks here somewhere
       {
         t=t->next;
        }
         t1=t->next;
         t->next=t1->next;
         free(t1);
     break;
    
    case 4:
     exit(0);
     break;
    }
    }
    }
    
    

    Previously, you have been using t like it was the tail of the list, but here you change it's purpose for a current pointer. You can't mix functionality like that. For example, if you add a few nodes, then delete the 2nd node, then try to add another, it will mess up your list because t is no longer pointing to the end. You should make a new variable to use when scanning the list. It is deleting the wrong one because you tell it to delete the wrong one. You find the node the user is looking for, then delete the next one. It fails when there is less than 2 because "the next node" that your code tries to delete does not actually exist. It will fail when you try to call the next property of the non-existant node. You should add some extra logic throughout your code to account for such cases.
  3. In Topic: predicate logic question

    Posted 6 May 2013

    Quote

    First of all you're missing a quantifier for x. As it stands now, your x comes out of nowhere.


    I think he is using "E" as the existential quantifier. Perhaps you are referring to the fact that he does not specify "There exists an x in domain"? Though it may seem sloppy, it is actually valid notation to leave off the domain that x belongs to and just say "There exists x". In such cases, the domain must be implied. In this example, there is only one domain so it is automatically implied.

    @Idonknow, the problem with your statement is that it is true if there is a student that knows logic, or if x is not a student. So, even if no students knew logic, your statement would still be true for mary and sue. You need to make a statement that is false if no students know logic.
  4. In Topic: Math Tutor

    Posted 28 Apr 2013

    First of all, I think the assignment states it backwards. A smaller number can never evenly divide into a larger number. So, we will assume it is meant that the larger number needs to evenly divide into the smaller.

    Since we know the smaller will not evenly divide into the larger, you can actually just test both. Then use an if statement like you did for subtraction for the output. You will need to add a while loop inside the case statement to test this.

    case 4: while(/*neither number divides into the other*/)
    {
         /*generate new numbers*/
    }
    
         if (num1 > num2)
         {cout << "  " << setw(5) << num1 << endl;
         cout << "/ " << setw(5) << num2 << endl;
         cout << "  " << "-----\n\n";
         result = (int)num1 /(int) num2;}
         else
         {cout << "  " << setw(5) << num2 << endl;
         cout << "/ " << setw(5) << num1 << endl;
         cout << "  " << "-----\n\n";
         result = (int)num2 /(int) num1;}
    
  5. In Topic: What is the probability of (X=6)?

    Posted 16 Apr 2013

    Quote

    The definition of "probability" is "# 'good' outcomes divided by # all outcomes".


    This is only true if every individual outcome is equally likely. When they are not equal you apply weights.

    For example: 2 different colored balls yield 2 potential outcomes.

    Now if we have 3 balls, 2 of which are red the other blue, then the denominator is 3 even though we still only have 2 outcomes. This is because one outcome can occur twice. It has a weight of 2.

    If you are still thinking "That's different, there are 3 individual outcomes and 2 are counted as good", then rephrase it as "there are infinite groups of 3 balls. Each group has 2 red and 1 blue". If you pick a ball at random, there are infinite individual outcomes. Is the probability of picking blue 0? Or, are there 2 outcomes where one is weighed twice and the other once.

    Probability is actually the sum of the weights of the 'good' outcomes divided by the sum of the weights of all outcomes.

    You can have infinite outcomes when the weights become increasingly smaller. As x goes to infinity, the weight of x goes to zero at a sufficient rate. The sum of the weights would still be finite.

My Information

Member Title:
D.I.C Addict
Age:
28 years old
Birthday:
July 23, 1984
Gender:
Interests:
Chess, math, computers, AI
Years Programming:
6
Programming Languages:
C++, C#, VB.net, SQL, OCAML, LISP, MIPS

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Friends

mojo666 hasn't added any friends yet.

Comments

mojo666 has no profile comments yet. Why not say hello?