C++ :: Cannot Seem To Find Logic Error In Perceptron
Jan 28, 2014
I can't seem to find the logic error in my perceptron. The perceptron's feedback function pushes back a bias of 1.0 into the input vector, and calculates the dot product of the input vector and it's weight vector, and returns 1 if the dot product is > 0, and -1 otherwise. This will determine whether the inputted point is above or below the hyperplane given by the functor.
The training function instantiates a trainer object , which feeds it a vector random numbers, along with the correct answer (in this case, whether the point is above or below the hyperplane given by a functor). It then calls the feedback function, and subtracts its answer from the correct answer, and updates the weights by adding the input vector to the weight vector, and multiplying the weight vector by the error, and by a correction factor, in this case 0.01.
I have been struggling with this program. I am somewhat new to c and suck at logic. I have a personal program I want to make that I will try to get extra credit for in school. I have a printed set of winning lottery numbers form the last 10 years. I chose the easiest one do do logically which is just 5 numbers none repeating.
I am trying to find out how I can print the least common 10 sets. I think if there are any set which have not been picked I would have to print all of those because logically they would all be equal, then print sequentially the sets least picked up to 10.
I have pseudocode which I am sure is wrong but will post it just to show that I am trying. My first attempt was to add the numbers but quickly realized that that wouldn't work ...
5 Nums Pseudocode Code: Read Nums Parse Into Ints Make Array [185] //39+38+37+36+35 The highest the numbers added together can go
So I have a program where I solve a maze using stacks. So my display_maze function take two parameters and displays the maze according to where the x coordinate and y coordinate are.
I have an error during my move function, as my maze doesn't display for some reason
In a record I have IDs of type int but some may repeat. These IDs also got sales of type float. I wish to compare the IDs number of times they appear and of match found accumulate their sales and put it in another struct. However if an ID is found which is new I pass it to a function to initiate sales..but my code never reach second ID, given I am trying with two IDs.. given IDs in transFile
ID Sale
12345 870 90909 100
I enter these two in transFile and match it with masterRecord. 12345 is matched and updated likewise but 90909 is never executed or matched in checkID function..
void sync_trans_files(unsigned short int count, master masterRecord[], char transFile[]){ const short int weeklyemployee=25; //read number of records from transFile; struct trans{
I created a program to convert files to XML. This if statement is giving me some trouble. I am trying to replace all &s with the XML & so that &s will work in the entities of the XML file. Some entities have more than 1 &. With those which have more than one I get an output like this: <cit:district>Anambra & Enugu & Eb</cit:district> .
I once again have a logic error. This time I am positively baffled: I am making a function that messes with three vectors it receives as parameters. The function adds new items to those vectors, but the funny thing is, while it completely normally adds items to two of the three, it fails to do so for the first, despite the fact that I use the same template! Here the function is:
I recently wrote a perceptron that determines whether a point is above or below a line. I'm trying to write a multi-layered ANN so I can use it to solve more complicated problems than "is this point above/below this line?"
Here's my source code: [URL] ....
Considering that a A XOR B is simply (NOT A AND OR (A AND NOT , and both of those are linearly separable...
Cannot manage to find the error source when i try running the program, the first part of the program runs just fine its when i try to get the temperature one that i get the error
#include <iostream> #define pi 3.141592 using namespace std; int main() { double r, h; //declare variables for radious and height double Surfacearea;
Using VC++ 2010 Express. I am creating a dll to export a simple Multiply function so I can use it in Excel/VBA
These e are the steps I am following :
. Create a Win32 C++ Project and give a name. For example: CallDllFromVBA . Select the DLL option in the Wizard and click Finish . In the CPP file (here CallDllFromVBA.cpp), add the following code
#include "stdafx.h" int _stdcall Multiply(int x, int y) { return x * y;
[Code] ....
The Build output show everything is ok as follows :
CallDllFromVBA.cpp CallDllFromVBA.vcxproj -> c:documents and settingsadministrateurmes documentsvisual studio 2010ProjectsCallDllFromVBADebugCallDllFromVBA.dll ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
In VBA, I insert a module and add the following code:
Declare Function Multiply Lib _ "c:documents and settingsadministrateurmes documentsvisual studio 2010ProjectsCallDllFromVBADebugCallDllFromVBA.dll" _ (ByVal x As Long, ByVal y As Long) As Long Sub test() MsgBox Multiply(2, 4) End Sub
When I run the Test sub I get the error: 453 - Can't find dll entry point
I also opened the CallDllFromVBA dll with Dependency walker and I can't find the Multiply export function - In fact, the dependency walker doesn't show any function exports at all for the CallDllFromVBA dll !
I'm receiving a char array consist of 8 characters, what I want to do is find the number of set bits in that array and then send it(total number) as a character to the transmitter so he can check, data is transmitted using serial port(RS232), where processing of data is done by DE0 FPGA.I've tried to use TestBit but the compiler doesn't know this function(I added #include "bit-manipulation.h" but it doesn't recognize this either) ...
-- the code of my project:
filed = open( "/dev/uart_0", O_RDWR ); if (filed < 0){ printf("the port can't be opened ");
im trying to read employee information from a file using structures but im having problems with getting the file to open and read in the information
Code:
Write a programt that inputs (at most 50) records from a sequential file #include <stdio.h> #include <stdlib.h> struct employee // employee structure definition }
I have been looking and i'm stuck on this. I wrote this program to find quarks and their charge and mass but i need it to give me 5 different ones. so i made an array but when i run it it gives me this
"Unhandled exception at 0x001631c6 in DiasQuarkP1V0.exe: 0xC0000005: Access violation reading location 0xd5bf0c38." and it shows the xstring library.
this is my main, is their anything wrong with my code?
#include "StdAfx.h" #include <stdio.h> #include <string> using namespace std; int main() { Quark solution[5]={};
I wrote a program with a recursive() called finder. But it dose not work properly,at run time it becomes to a infinite status. How to detect the error at runtime. Here is the code.
#include<stdio.h> void finder(int x,int y); int tot;
[Code] ....
I think the error is the changing value of x after a round of for loop.
Code: 1 121 12321 1234321 123454321 EDIT: the above pyramid looks like a doom.i.e 1-5 will be in center.1-4(L)1-3(L)1-2(L)1(L) similarly 1-4(R) 1-3(R) 1-2(R) 1(R)
I'm partly successful in building the requirement of the program.but cant able to think the logic for the other half. how can i proceed.below is the code written in c#.
So I'm trying to take some information that a user inputs and to then write it into a .txt file. The user would input a student ID followed by 4 quiz grades. I need to use nested loops for the input, a while loop for the outer and a for loop for the inner.
The data in the .txt should would look like: studentID quiz1 quiz2 quiz3 quiz4 studentID quiz1 quiz2 quiz3 quiz4 etc.
My problem is I'm not sure how to structure the code. I have very few examples I'm working with to understand what I'm working with.
I was developing an exercise program for myself (note: not a project in school) to enhance my programming skills in C++ then I encountered a "logic bug" (that's how I call it :D ) I think. I googled stuffs I need to know and ended up to post my question here.
Here's the scene:
1. When using GetAsyncKeyState I can capture Function Keys [F1-F12, etc..]
2. While doing and having fun to my exercise program, I suddenly noticed that whatever key I pressed from the keyboard {example: asdfkj], it keeps the keys entered and brings to a "field" that accepts user input.
What you should do...
1. Press any key (example: asdfisdjfisdjff) then proceed to press F1. And see what happens. I don't know how to erase what I have entered before pressing F1.
here's the code.
#include <cstdlib> #include <iostream> #include <windows.h> #include <string> using namespace std; void gotoxy(); void gotoxy( int column, int line ) {
I'm trying to create program that reads in commands from an input file, and accordingly creates, connects or destroys logic gate primitives (and gates, or gates). Additionally, I'm trying to modify a previous program that I wrote to do this using QThreads, where each gate is placed in its own QThread. I'm trying to avoid using invokemethod, and I'm sure this method can work. My specific issue that I'm having trouble debugging is in my connect code block in main.cpp. Whenever I try to reference a gate specified by the input file that is NOT the true or false gate (I have one of each and they are attached to any gate that needs a true or false input), I get only a NULL reference. This includes attempting to reference the gate in my gatelist QMap. Calling gatelist.value(newCommand.at(1)) causes the program to hang, and the connect statements referencing said gate return errors about connecting a signal or slot of a NULL pointer.
Here is main.cpp: #include <QPointer> #include <QMap> #include <QDebug> #include <QString> #include <QFile> #include <QTextStream>
[Code] ...
My accompanying class declarations can be found here : [URL] ....
My issue is regardless of which date I input its always defaulting to the values I have set in my constructor in my implementation file in the else statement. So the values always default to 3/15/2006 I think its something to do with the logic in my bool function but I may be incorrect.
header //date.h header #include <iostream> #include <string> using namespace std;
enum DateFormat {numeric, standard, alternative}; const int MIN_YEAR = 1900; const int MAX_YEAR = 2015;
I need to create code based upon the following pseudo code:
dictionary=vector file containing words to search for=external file
While there more words to search, for search the dictionary if the entire dictionary is searched and the word is not found, return the word, search the dictionary for the next element (and so on)
I cannot for the life of me figure out the sequence of loops to do this. The following code returns all of the words instead of just the ones not found in the dictionary, but it's all I've got after countless changes:
#include <iostream> #include <fstream> #include <vector> #include <string> using namespace std; int main() { string dictword; ifstream dictionary;
I'm new in programming, and trying to write a code in C. The requirement is following - to write a text, and to find frequency of 1 chosen character in it. The main thing is that program should check user input (for example, I want to check if user entered "char" --> then correct, or if entered "int" --> not correct). But the program still doesn't check. So I have:
Code: #include <stdio.h> int main(){ char c[1000], ch; char i, count=0; printf("Enter a text: "); gets(c);
I have a doubly linked list from which I need to occasionally delete elements (any elements that have a type value different from 0). The function I have seems to work, but looking at it, I think I could probably make the logic cleaner.
The structs in questions are declared here, with irrelevent variabled omitted:
I'm new to C#. I'm trying to create a program to audit some of our processors. As you will see below, I have two foreach loops that allow me access to errorOrders(returns <<UserName, #of errors>>) and totalOrders (returns <<UserName, #of totalOrders>>).
However, the problem i'm running into now is that it seems to constantly loop through these two ForEach loops. When i run it, the 'count' on both errorOrders & totalOrders is 38. The program loops through all 38 users just fine, but then it continues to loop through users again...re-doing the process that it just finished.
I'm looking to see if there is another way I could set this section up so that it only loops through users once. I was thinking about trying to create a 'Boolean flag' that would force the program out of the ForEach loop after it has run through all the users...but i'm sure there are other ways to handle this.
foreach (KeyValuePair<string, int> error in errorOrders) { foreach (KeyValuePair<string, int> total in totalOrders) {
[Code]....
I know i should probably seperate these two foreach loops instead of having them nested..however, the problem that arises once i do that is my errPercentage can not be calculated if i do.
I have a hit a snag in a number guessing game program. I was given a half-completed program and told to use functions to complete the missing pieces. It looks unwieldy, but this is how it is supposed to be. I have temporarily made the random guess value visible for troubleshooting purposes.
#include <iostream> #include <time.h> #include <stdlib.h> using namespace std; int welcome() { cout << " Welcome to the hi-low game!" << endl;
[code]....
The issue lies within this piece of code:
checkGuess(guess, correct); done = false; //either true or false } while (!done); cout << "Congratulations, you got it!" << endl; return 0; }
I need to manipulate the Boolean variable done so that it registers as false when the user inputs a number higher or lower than the randomly selected value. However, if the user guesses correctly, done will become true and the program will end.
As it stands now, the program will not terminate, and if I set done equal to true like so:
checkGuess(guess, correct); done = true; //either true or false } while (!done); cout << "Congratulations, you got it!" << endl; return 0; }
Every number the user inputs will register as correct instead of the one right guess.
I've just recently started to learn C++, and I'm encountering some errors I can't seem to figure out.
InventoryItem.h:
Code: #pragma once class InventoryItem { public: InventoryItem(string name, int amount); ~InventoryItem(void); string getName(void); int getAmount(void);