I know were suppose to store the points into an array for each click, then when you click line, the line will connect to all points.

Okay, what exactly are mouse hooks?
I'm sorry we have no book for this class and my professor isn't
helpful at all.

Everything shows up but I want to screen to be blank when I automatically run the program and when the user clicks wherever an X appears and it stays at the point.

I'm having trouble with this windows program its in Visual C++ and it's my first time
really using and type of windows console.
I'm trying to get the program to where the program starts up there is nothing on the screen but then the user left clicks a 'X' appears and the user can click on the screen and make multiple X's on the screen.[code]// menu item
//#define IDM_LEFT 101
//#define IDM_RIGHT 102
//#define IDM_UP 103
//#define IDM_DOWN 104

define IDM_RESET 107
define IDM_QUIT 108
define IDM_CLEAR 109
define IDM_LINE 110

// trim the excess fat from Windows

include <windows.h>
include <stdlib.h>

const int
xmin = 0, xmax = 330, xstart = 150,
ymin = 0, ymax = 205, ystart = 100;
int x = xstart, y = ystart;

void draw(HDC hDC) {
TCHAR str[256];
wsprintf(str, TEXT("X"), x, y);
//SetTextColor(hDC, COLORREF(0x000000FF)); // 00BBGGRR
SetTextColor(hDC, RGB(0xFF, 0x40, 0x80)); // RRGGBB
//SetBkColor(hDC, RGB(0x00, 0x00, 0x00)); // RRGGBB
TextOut(hDC, x, y, str, (int)wcslen(str));

void createMenu(HWND hwnd) {
// menu without a resourse file
HMENU hMenu, hSubMenu; // local variable

hMenu = CreateMenu();

// submenu
hSubMenu = CreatePopupMenu();
AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hSubMenu, TEXT("&File"));
AppendMenu(hSubMenu, MF_STRING, IDM_RESET, TEXT("R&eset"));
AppendMenu(hSubMenu, MF_SEPARATOR, 0, 0);
AppendMenu(hSubMenu, MF_STRING, IDM_QUIT, TEXT("&Quit"));

// no submenu
//AppendMenu(hMenu, MF_STRING, IDM_LEFT, TEXT("&Left"));
//AppendMenu(hMenu, MF_STRING, IDM_RIGHT, TEXT("&Right"));
//AppendMenu(hMenu, MF_STRING, IDM_UP, TEXT("&Up"));
//AppendMenu(hMenu, MF_STRING, IDM_DOWN, TEXT("&Down"));
AppendMenu(hMenu, MF_STRING, IDM_LINE, TEXT("&Line"));
AppendMenu(hMenu, MF_STRING, IDM_POLYNOMIAL, TEXT("&Polynomial"));
AppendMenu(hMenu, MF_STRING, IDM_CLEAR, TEXT("&Clear"));
SetMenu(hwnd, hMenu);



Hi I am trying to upgrade my video card so I can play the Sims 3, but I'm having the hardest time trying to figure out what kind of video card I need, Dell Tech support was no help so I was wondering if anybody could I.D. what kind of specific graphics card I would need.


I've got this bug in my progrom that I cannot figure out and it's due within the next couple of hours. I was hoping someone could help.

My problem is in my main function that reads in from standing input
but when the user types in $PART2 it is suppose to break and go onto
the next input. But whenever I type in:

C = 7
D = 6

the function will not go on to the next part because it should print
System.out.println("Enter PostFix Expression: ")

If you could help me figure out why I would greatly appreciate it.

import java.util.;
import java.io.
import java.util.Scanner;
import java.util.Stack;
import java.lang.Character;

class PostEval2

static Stack<Integer> postFix = new Stack<Integer>(); // a new stack of integers
public static final int integers=26; // the max number of integers for the array
static int [] array = new int[integers]; // a new array

// int addr(char ch) returns the equivalent interger address
// for the letter given in ch, 'A' returns 0, 'Z' returns 25 and all
// other letters return their corresponding position as well.

public static int addr(char ch)
return (int)ch-(int)'A';

// void eval( char letter) will evaluate the postfix expression
// from what the user entered. If will make sure that letter is a digit
// then it will begin doing the equations for whatever operand is used.
// it will final push the result into the stack.
public static void eval(char letter)
int result ...

Hi, I'm trying to write a java program that will read in the scanner input from a user and outputs an postfix expression and answer
so if you typed in:
A = 5
B = 7

the output would be
AB+ = 12

I'm having trouble with the scanner input I can make it so a user
can enter a letter and a number, but I'm having trouble trying to make the program shift so when the user enters $PART2 it will then begin to read in the post fix expressions.

If anyone could help I would greatly appreciate it.


import java.util.;
import java.io.
import java.util.Scanner;
import java.util.Stack;

public class PostEval

static public void main(String args[])

 Scanner scanner = new Scanner(System.in);

Stack<String> postFix = new Stack<String>();
String part2 = "$PART2";
System.out.println("Input Letter and Number it equals: ");
String letter = scanner.next();
char equals=(scanner.next()).charAt(0);
int number = scanner.nextInt();
System.out.println("You Inputted:"+ letter+ equals+ number);
if(letter == "$PART2")
String postfix = scanner.nextLine();



it will read in some imaginary output I guess is the best way the say it.
Since there are no spaces or new lines, its reading something that it shouldn't
that's why I get
a 2
b 1
does that make sense?

Hi I was wonder if anyone could help with this problem I am receiving. My program is suppose to read in any character frequencies from a file, even spaces and /n. My problem is that is reading an extra character that I can figure out.
I had inputed a text file that [B]aab[/B] no spaces and no new lines. It would out put as
The Character Frequencies are
a 2
b 1
which throws everything off.
This program will make a huffman code out of the frequencies, but it messes up everything cause of the unknown space and 1. Here is what I've been using for my read input. If anyone could take a look I would really appreciate it.


include <cstdio>
include <fstream>
include <iostream>
include <cstring>

//tab space 1
using namespace std;

void phase1(int array[], ifstream& in)
int c = 0;
for(int i = 0; i < 255; i++)
array[i] = 0;
while(c != EOF)
c = in.get();
c = (int)c;
array[c] = array[c]+1;

//phase2 prints the frequency of each character
//read from a text file
void phase2(int array[])
int n = 0;

cout << "The character frequencies are: " << '\n';

while(n < 255)
if(array[n] != 0)
cout << (char)n;
cout << " ";
cout << array[n];
cout << "\n";
n = n + 1;

int main(int argc, char* argv[])
ifstream in(argv[1]);
int array[256];
phase1(array, in);
return 0;


Hi I am having trouble trying to get my add and remove function to work.
We had to create an ADT List using array's.
It keeps giving my program errors
any help would be great, I think my problem might be my second part of the add function
where it will add in between 2 arrays

// ****
// Reference-based implementation of ADT list using arrays.
// ****
public class List {
// reference to linked list of items

public static final int MAX_LIST = 20;
public static final int NULL = -1;

private ListItem item[] = new ListItem[MAX_LIST]; // data
private int next[] = new int[MAX_LIST]; // pointer to next item

private int head; // pointer to front of list
private int free; // pointer to front of free list
private int numItems; // number of items in list

// Constructor must initialize used list to empty and free list to
// all available nodes.

public List()
int index;
for (index = 0; index < MAX_LIST-1; index++)
next[index] = index + 1;

next[MAX_LIST-1] = NULL;

numItems = 0;
head = NULL;
free = 0;

} // end default constructor

public void removeAll() { // reinitialize all nodes to free
int index;
for (index = 0; index < MAX_LIST-1; index++)
next[index] = index + 1;

next[MAX_LIST-1] = NULL;

numItems = 0;
head = NULL;
free = 0;

} // end removeAll

public boolean isEmpty() {
return numItems == 0;
} // end isEmpty

public int size() {
return ...

Hi I'm having trouble with this program I am working on. It is to simulate a grocery store. The program will read in a file which is called inventory.dat
the file will have items in it like:

11012 gallon-milk 1.99 F
11014 butter 2.59 F

Then a customer will input the product number then the quantity they want
then they will type 0 0 to end their order. When that happen it suppose to ouput a reicpet.

Customer Input

11012 1
11014 1
0 0

Output Recipet

Customer 1

gallon-milk 1@1.99
butter 1@2.59


I keep getting the errors
Exception in thread "main" java.lang.NullPointerException
at GroceryItem.itemSearch(GroceryItem.java:64)
at GrocerySim.calcCustomerReciept(GrocerySim.java:98)
at GrocerySim.main(GrocerySim.java:138)
I've gotten lost in my code and I'm having a hard time trying to figure out what to do next.

Here is my code for it in two parts GroceryItem and GrocerySim
import java.util.;
import java.io.

public class GrocerySim {

    public static final int MAXNUMBEROFITEMS = 100;    // the maximum number of items that can be bought.
    static GroceryItem[] dataList=new GroceryItem[MAXNUMBEROFITEMS];
    static int inventory=0;
    static int quantity=0;
    static int productNumber=0;

/ readIventory will read in the file "inventory.dat" /

private static void readInventory(String filename)
    Scanner fileInput;
    File inFile = new File("inventory.dat");
       fileInput =  new Scanner(inFile);
             ++inventory;  //stick update for inventory
             System.out.println("File was read successfully.");      // Debug to make sure file was read in correctly.
                                            System.out.println("Item Number "+dataList[inventory].getProductNumber()+" has already been added.");


      catch(FileNotFoundException e) ...

Thank you that worked.
I really appreciate your help!

Hi I was wondering if anyone could help
I'm receiving a segmentation fault whenever I go to run
my main.cpp on my program. I've never encountered this before
and was wondering if anyone knew how it can be fixed.

The program consist of equiv.h, equiv.cpp, graph.h, graph.cpp, and main.cpp

here are the files

[code] const int maxVertices = 50;


  • Equiv *
  • Equiv is a structure type that holds a *
  • pointer to an array of integers and an *
  • integer of the size of that array. *
    struct Equiv
    int* arrayIntegers;
    int arraySize;

bool together(Equiv& e, int x, int y);
void combine(Equiv& e, int x, int y);



include <iostream>
include <fstream>
include "equiv.h"


  • together *
  • together returns true if x and y are in the*
  • same set as object e. *
    bool together(Equiv& e, int x, int y)
    bool sameX = false;
    bool sameY = false;

    for(int i = 0; i < e.arraySize; i++)
    if(e.arrayIntegers[i] == x)
    sameX = true;
    if(e.arrayIntegers[i] == y)
    sameY = true;
    if(sameX && sameY)
    return (sameX && sameY);


  • combine *
  • combine puts x and y together by combining *
  • the two into the same set. *
    void combine(Equiv& e, int x, int y)
    if(together(e, x, y))

    bool switchX = false;
    bool switchY = false;

    if(e.arraySize > 0)
    for(int i = 0; i ...

Ancient Dragon commented: thanks for using code tags correctly the first time :) +36