C/C++ :: Charge Simulation Method?

Sep 26, 2014

how to write a "charge simulation method" program in C or C++? It's to calculate electric distribution and also electric potential of two different dielectrics. I have attached the diagram of the shape of the electrode that needs to be investigated.

View 1 Replies


ADVERTISEMENT

C++ :: Parking Garage Hours For Vehicles And Charge For Them

Oct 1, 2013

Write your question here.

Here is the code

#include <iostream>
using std::cout;
using std::cin;
using std::endl;
using std::fixed;
#include <iomanip>

[Code] ....

My question is how would i put in the total of hours for the vehicles and the total hours for the garage for the vehicles of input... set like this

Car Hours Charge
1 1.5 2.00
2 4.0 2.50
3 24.0 10.00
Total 29.5 14.50 <---This is what i need for my code still

View 1 Replies View Related

C++ :: Program To Find Quarks And Their Charge And Mass - Giving Error

Mar 3, 2013

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]={};

[Code] .....

View 1 Replies View Related

C++ :: Undefined Reference To (method Name) When Accessing Method In Static Library

Jan 17, 2013

I've been trying for more than one month to access a method found in a library called libcocosnas_static.a. I'm using Cocos2d-X version 2.0.4. The library has been used many times by my company to make games using cocos2d-1.0.1-x-0.12.0 without any problem.

This is what I've done:
1- I added the include paths of the library to both eclipse and Android.mk
2- Included the .h file using #include "NASPlatformUtil.h"
3- Added the libcocosnas_static.a file to the proj.androidobjlocalarmeabi folder
4- Added "LOCAL_WHOLE_STATIC_LIBRARIES += cocosnas_static" to the Android.mk file
5- Called the function using: NASPlatformUtil:: openUrl("http://xxx.xxx.com/");

I can right click on the function, click Open Declaration and get it without any problem, but the compiler keeps on giving me that dreaded error...

View 3 Replies View Related

C++ :: Packets And Tcp Simulation?

Nov 24, 2014

I have to write a program to take packets of information destined for certain ports then provide the current message using the packets I've gotten so far. Packets can come out of order, so when asked for the message, packets that haven't arrived yet are skipped and the next packet is appended. After giving the message, I have to delete all the current packets as well as ones that are received late, after the packets that were supposed come after the late packet were already provided in the message.

Data:Up to 1000 ports, numbered 0-64000, and each message can contain up to 1000 packets.

View 2 Replies View Related

C/C++ :: Email Simulation Using Queue?

Feb 1, 2015

Here is the assignment I get:

Write an email simulator that processes mail at an average of 40 messages per minute. As messages are received, they are placed in a queue.assume that the messages arrive at an average rate of 30 messages per minute.messages must arrive randomly.

Each minute, you can dequeue up to 40 messages and send them. Assume that 25% of the messages in the queue cannot be sent in any processing cycle.use a random number to determine whether a given message can be sent. If it can't be sent, enqueue it.

Run the simulation for 24 hours, At the end of the simulation, print the statistics that show:

-The total messages processed.
-The average arrival rate.
-The average number of messages sent per minute.
-The average number of messages in queue in a minute.
-The number of messages sent on the first attempt, the number sent on the second attempt, and so forth.
-The average number of times messages had to be requeued (do not include the messages sent the first time in this average)

Well, actually I've done a part of the coding. But how to continue it. And here is my code :

#include <iostream>
using namespace std;
#define SIZE 40
class Queue {
int queue[SIZE];
int head, tail;
public:
Queue();
void Enq(int num);

[code]....

View 1 Replies View Related

C++ :: Dynamic Linking Of Two Software For Co-Simulation

Jan 25, 2013

My Project is to Dynamically Link 2 Software for Co-simulation n C/C++. So that Output of One Software becomes Input of Other automatically . at present we input the parameters manually in both the software . what to do so that it pick up values itself and gives the output by solving each and everything at once in both the software .

View 5 Replies View Related

C++ :: Flash Memory Simulation Using A Code

Jan 23, 2013

I have to simulate flash memory using C++ for a project.

View 2 Replies View Related

C++ :: Combinational Logic Simulation Using QThreads

Oct 30, 2013

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] ....

View 6 Replies View Related

C++ :: Lotto Simulation - Defining User And Lottery?

Feb 11, 2013

How do i define user and lottery..

//Declarations
#include <iostream>
#include <cstdlib>
#include <ctime>

const int lotteryDigits = 10;
const int SIZE = 5;
const int Power = 1;
int generateLottery(int[], int, int);

[Code] ....

View 15 Replies View Related

C++ :: Error In Classic Bank Teller Simulation Program?

Feb 17, 2014

Anyhow, I have a program due Wednesday that is along the lines of the classic Bank Teller simulation using Queue's.

Unlike most of these programs, I have to integrate my own Queue, QueueNode, Teller, and Customer classes. I have attached all of these headers below plus the main file.

Now the error: While I'm sure there are other issues with the code, it will not let me create a new customerQueue (of Queue type) object as such:

Queue<Customer> customerQueue;

The error it is giving me is:

no matching constructor for initialization of 'Queue<Customer>'

Here is my code:

Queue.h:

#ifndef QUEUE2_H_
#define QUEUE2_H_

#include <iostream>
#include "Teller.h"
#include "Queue.h"

[Code] ....

View 1 Replies View Related

C++ :: Simulation Of Motion Of Magnets On A Rod - Long Double Not Working

Apr 25, 2013

I'm currently working on a simulation of the motion of magnets on a rod. As part of it, there are arrays of the properties of the magnets:

long double *accelerations; // These will later be dynamically allocated depending on the number
long double *velocities; // of magnets
long double *positions;

However, when I go to compile this, the compiler gives me these error for the pointers:

error: two or more data types in declaration of 'accelerations'
error: two or more data types in declaration of 'velocities'
error: two or more data types in declaration of 'positions'

Apparently, the compiler isn't recognising long double* as a type and is instead reading is as the two types long and double*.

My compiler is MinGW 4.4.3

View 4 Replies View Related

C++ :: Build A Banking Simulation Program Around The BankAcct Class?

Sep 5, 2014

I'm supposed to build a banking simulation program around the BankAcct class, which provides the following service: create new account with unique account number (maximum 5 accounts created in a single test running); deposit/withdraw; print information of all existing account. I was running a test program with only 2 services first, namely creating new account and depositing, but the program just keep on crashing and I couldn't figure out why.

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

[Code].....

View 1 Replies View Related

C++ :: Pass Method Of Derived Class As Parameter To Another Method In Base Class?

Feb 2, 2015

I have a question similar to the one here: [URL] .....

The main difference is I would like to pass a method of derived class as a parameter to some other method in its template base class.

template <typename BaseType>
class Base {
public:
typedef void (Base::*Callback)(int A);

[Code] .....

The above is an example which does not compile. My compiler complains that the two BaseMethod() calls in DerivedMethod() are invalid uses of non-static member function.

Is this not possible to do, or is my syntax simply wrong? All I want is to be able to pass as an an argument to a method in the base class from the derived class some callback as a variable for the base class to invoke later.

View 2 Replies View Related

C++ :: Method To Loop Through Network IPs

Nov 25, 2013

This problem relates to a program i am developing to ping all hosts on a network.

So far I've managed to access a PostgreSQL database to retrieve a CIDR network address e.g. 192.168.52.14/24.

I have then managed to mask the bits to get the network address.
So for e.g. above its 192.168.52.0

I now need some kind of algorithm to loop through available hosts so from.

192.168.52.0 - 192.168.52.255

I have got as far as deriving the network and separating it into an int array

So I have : ip_start[]= {192,168,52,0}

View 1 Replies View Related

C++ :: Using Reference With Virtual Method

Mar 19, 2013

#include <iostream>
using namespace std;
struct A {
virtual void f() { cout<<"A
"; }
};

[code]...

I would expect that both examples 2 & 3 will give me the same result.I tried to figure it out but I could not. Both are references of a base class type, that get a derived object.

Q1 : why is the difference between them ?

As I see it, its kind of a mix between pointer - which in case of virtual method that was override in derived class - would give me the derived method (e.g. "B") and between regular object - which in case of virtual method that was override - would give me the specific method (Still "B"). So, example 2 "use" it as a regular object and example 3, "use" it as pointer.

Q2 : How should I refer to it ? I am using VS2008.

View 12 Replies View Related

C++ ::  Inheritance Using Base Method With Other Name?

Feb 18, 2015

I have 2 classes with a Function with the same definition (both inherited from the same base class) and in my derived class I derive from both of those 2. Is it possible to use the Methods of both classes? for example with an other name?

class A {
protected:
int print(int a) { std::cout << "int A: " << a << std::endl; }
};
class B : A

[Code] ....

is there something like using C::print as printc;?

The Problem, I have a Sprite class that derives from a Rectangle with properties Position, Size, Origin and Angle and a Text class that derives from Rectangle. Now i have a Button class deriving from both Sprite and Text.

- The Position, when moving the Button i have to change the position of both so i Implemented a new Method which calls SetPosition from the Sprite and the Text.
- The SetSize just affects the Button so i just did using Sprite::SetSize;
- The angle affects both so i just implemented a new Method and hide the other two

The problem is here:
- The Origin: writing button.SetOrigin(-1,0) should set the Origin of the Button and writing button.SetTextOrigin should set the Origin of the text.

Should i just reimplement a Mehtod named SetTextOrigin and call Text::SetOrigin from there and hide the button.Text::SetOrigin or is there something like using Text::SetOrigin as SetTextOrigin?

View 6 Replies View Related

C++ :: How To Declare Empty Method

Oct 11, 2013

It has been a few years since I have had to do this, but I need to declare a method in my base class, but produce no code for it. Then when this library is used by my second project I will derive a class from this base class and put the code into it there. How is this possible? I used to know how but do not remember how now.

The library is a static library designed for linking with both 32bit and 64bit Windows applications to handle a lot of the tedious stuff with Windows programming. The method in question handles specific command inputs. However, since each program that uses this library will have different uses for these commands, I want to leave it up to the user to code their own handling, but require it to be coded in the derived class.

View 2 Replies View Related

C# :: Delete Method Not Working?

Apr 19, 2015

Here is the Method Code:

public void DeleteCustomer(string firstName, string lastName,
string address1, string address2, string city,
string state, string phoneNumber, int customerID)
{

[Code]....

.... And here is the response I get:

Error Deleting customer, please check form data. Syntax error in FROM clause.

View 13 Replies View Related

C# :: How Can A Method Work With Just A Declaration

Feb 28, 2015

I want to access the body of the Add() of a list in c# to see how it works, but it only just gives me the declaration.

[DebuggerTypeProxy(typeof (Mscorlib_CollectionDebugView<>))]
[DebuggerDisplay("Count = {Count}")]
[Serializable]
public class List<T> : IList<T>, ICollection<T>, IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable {
public void Add(T item); // thats all. I tried go to declaration but still gives me this line of code. This is from metadata in Visual studio.
}

How this thing work. It just a declaration not a definition yet its still doing something. How is that possible.

View 4 Replies View Related

C# :: Calling Same Method Twice With Different Output

Dec 24, 2014

Allow users to enter their name and favorite saying in a single method that gets invoked two times. If I can only return one value at a time, how am I suppose to get name and favorite saying out of UserInput()?

static void Main(string[] args) {
string displayName, favoriteSaying;
DisplayInstructions();
Console.WriteLine();//readability

[Code] ....

View 3 Replies View Related

C# :: Passing Array To Method With GUI

Sep 29, 2014

I have to create a program that accepts 10 numbers from user, and then I display a list of the numbers, the smallest one and the higher number. I have problems with displaying the smallest and higher number, I tried to Array.Sort and Array.Reverse, but I don't know what I'm doing wrong, this is my code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SmallAndLargeGUI

[Code] ...

Also I tried to set

if (x == 10)
numberTextBox.Enabled = false;

to block the textbox when the user has entered 10 numbers, but didn't work either...

View 4 Replies View Related

C/C++ :: How To Input A Recursion Method

Feb 7, 2015

I am trying to input a recursion method. The code compiles, however, it is only giving me a value of 1. I am wanting the value of 5 when it is compiled. Why is this?

#include <iostream>
using namespace std;
int number(int x) {
if (x == 1)

[Code] ....

View 9 Replies View Related

C Sharp :: Why Use Static Method In C#

Feb 17, 2013

what is static method?

why we can use static method inc#?

View 1 Replies View Related

C++ :: Object Method Does Not Respond

Oct 17, 2012

I am studying the creation of classes in C + +. When executing the code below the method LEN class String2 not work.

code ----------------------------------------------------------------------------------------------
#include <iostream>
#include <string.h>
using namespace std;

[Code]......

View 4 Replies View Related

C++ :: Inherited Method Not Called?

May 6, 2014

OgreWidget.h

Code:

#ifndef __OGREWIDGET_H__
#define __OGREWIDGET_H__
#include <OGRE/Ogre.h>
#include <QGLWidget>
//#include <QX11Info>
class OgreWidget : public QGLWidget {
//Q_OBJECT;

[Code] ....

The inherited method called createScene is not called.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved