C Sharp :: Retrieving USB Pendrive Vendor ID / Product ID And Serial Number

Sep 15, 2012

I am trying to retrieve the parameters from externally connected pendrive. I have been using WMI to achieve this but not able to separate the pendrive's parameters from the other USB devices (such as USBcamera,USBHub etc) ....

View 2 Replies


ADVERTISEMENT

C++ :: Retrieving First Three Bits Of A Number

Apr 25, 2013

I am trying to retrieve the first three bits of a number. The code that I am using should work but it isn't giving me the correct result when trying certain numbers. Below is the code I am using:

unsigned short num1, num2 = 0;
unsigned short num = 65535// binary 111111111111111
num1 = num && 0x07;// gives me 1 but should give 7(111)
num2 = num >>3;//gives me 8191, which is correct

Why I am not getting the first three correct bits(111)?

View 2 Replies View Related

C :: Retrieving SIM Card Number From Dongle Using Program?

Jan 2, 2014

I want to get or view the SIM card number from the dongle (the dongle will b already connected to the computer where the SIM card will be inserted into it) but the coding should be done by C programming / Language.

View 5 Replies View Related

C Sharp :: How To Pick Date / Time When Serial Port Starts Reading And Also When Stops

Aug 18, 2014

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.IO.Ports;

[Code] ....

How to pick date / time when serial port starts reading , and also when reading stops ?

View 2 Replies View Related

C :: Read From A File Containing Serial Of Number

Jun 2, 2014

I want to read a file who contain a serial of number like in this example : +200,-100,+400,+200,-200 and the sign is very important for the rest of the program so i should save those signed numbers in an array or a struct that i can define with a boolen variable if it's + i give it 1 else if it's - it'll be 0

I wrote a basic file's code reader but i don't think there is a solution on it

Code:
void read_file(char *fil1){
FILE *f;
int ch[500];
f=fopen(fil1,"rt");
if(f==NULL)

[Code] .....

View 1 Replies View Related

C++ :: Read In Name Of A Vendor Into Array Of Structures

Feb 26, 2013

so im trying to read in the name of a vendor into an array of structures. and write the name into a file.

#include <iostream>
#include <cstring>
#include <cctype>
#include <fstream>
using namespace std;
struct booth

[code]....

View 5 Replies View Related

Visual C++ :: Vendor Classes - Conflicting Declaration Of Objects

Jan 22, 2013

The Light and Fan are two different vendor classes and they are not derived from any base class. I am trying to implement the Command design pattern but with generic implementation, so it should work in future with any new vendor class like Door, Window etc without much change in client code. I have thought about a Factory method but it will not work because it needs a Base class. I am trying to learn the design patterns.

Light *myobj;
Fan *myobj;
int choice;
cout<<"Select Light (1): ";
cout<<"Select Fan (2): ";

[Code] ....

Error:conflicting declaration 'Fan*myobj'

View 14 Replies View Related

C++ :: How To Get The Cross Product

Oct 10, 2014

I am trying to compute the cross product of an 1x6 column vector "D" with a 6xN matrix "S".

vector< vector<float> > D(1, vector<float>(6));
vector< vector<float> > S(6, vector<float>(10)); // Example where N = 10
float cProduct = D*S; // ?

The last line fails, so I'm wondering how you would get the cross product?

View 2 Replies View Related

C++ :: For Loop To Sum Up Product Of Several Arrays

Feb 2, 2013

I need a for loop that sums up the product of several arrays.

int total = 0;
for (int i=0; index < (columns - 2); index++)
for(int indexFF = 0; indexFF < CG[index + 2] - 1; index++)
for (int indexIN = 0; indexIN < CG[index + 1] - 1; indexIN++, total++)
NRN[CG[index + 1]+indexFF] += FF[total] * NRN[indexIN + CG[index]];

right now "columns" is set to 3

CG[] is an array of 10 integers for "column groups"

for now they are set to:

CG[0] = 0
CG[1] = 3
CG[2] = 4
CG[3] = 3

NRN[] is an array of floating points
NRN uses CG to map its indexes out

0 3 7
1 4 8
2 5 9
_6

FF[] is an array of random numbers basically constants

I need the for loops to sum:

NRN[0] = 0.5
NRN[1] = 0.75
NRN[2] = -1
NRN[3] = NRN[0]*FF[0] + NRN[1]*FF[1] + NRN[2]*FF[2]
NRN[4] = NRN[0]*FF[3] + NRN[1]*FF[4] + NRN[2]*FF[5]
NRN[5] = NRN[0]*FF[6] + NRN[1]*FF[7] + NRN[2]*FF[8]
NRN[6] = -1
NRN[7] = NRN[3]*FF[9] + NRN[4]*FF[10] + NRN[5]*FF[11] + NRN[6]*FF[12]
NRN[8] = NRN[3]*FF[13] + NRN[4]*FF[14] + NRN[5]*FF[16] + NRN[6]*FF[17]
NRN[9] = -1

NRN, FF and CG are the only things in other code that I can't change in the loops

when I debug it index goes to 3 and overflows its memory. which it shouldn't because columns = 3 so "index < (columns - 2)" should stop at 1

View 2 Replies View Related

C :: Creating Product Inventory File?

Jan 26, 2013

How to make a program in C to create a product inventory file containing pro0duct name, cost and quantity and then read the prouct inventory file.

View 9 Replies View Related

C++ :: Program That Prints A Discounted Product

Sep 29, 2014

So I need to make a program that reads distance and number of days of a person that is buying a ticket. If distance is greater than 1,000 kilometers AND the person stays more than 7 days, the discount is 30% of the ticket. The cost per kilometer is $1300. Print the ticket with discount.

I used variable distance as float because it will be multiplied with 0.3 for the discount... not sure if I'm right on that.

Code:
#include <iostream>
#include <conio.h>
using namespace std;
int main() {
float distance;
int days;

[Code] .....

I tried another way but haven't done it in code...

ask for distance
ask for days

Ticket= (Dist x 2 x $1300)
If (dist>1000) && (days>7)

cout<<Ticket=Ticket * 0.3;
else { cout<<Ticket;

View 2 Replies View Related

C++ :: Kronecker (direct) Vector Product

Feb 19, 2013

How to code the Kronecker/direct product of two vectors??

The direct product of the vectors a and b is given as the matrix below (note "x" refers to x with a circle around it and is the symbol for a Kronecker product):

(a1, a2,..., an) "x" (b1, b2,...,bn) = [a1b1, a1b2,..., a1bn]
[a2b1, a2b2,..., a2bn]
[ . . . . ]
[ . . . . ]
[ . . . . ]
[anb1, anb2,..., anbn]

The way I have coded the rest of the program is such that the matrix shown here is represented by a vector of length equivalent to the number of elements in the matrix. So I want the Kronecker product to give me a vector of length n^2 (where n is the number of elements in each initial vector).

View 3 Replies View Related

C++ :: Compute Area Of A Triangle Using Cross Product

Jan 8, 2015

I have to write some cpp program which computes area of a triangle using cross product,we give 3 vertices as R2 and 3 edges as double.

I am beginning like this;

#include <iostream>
#include "R2.h"
#include <cmath>
using namespace std;
double area ( R2 *A,double *z)

[Code] .....

View 5 Replies View Related

C++ :: Calculate Product Of 4 Vertical Values In Matrix

Jun 1, 2013

I am attempting to create a program which calculates the product of 4 vertical values in the matrix. The numbers are supposed to be randomly generated and the size of the matrix is given through the command window.

However I seem to have either not pointed my matrix through all of my functions correctly, or my logic is off somewhere as I keep getting this output regardless of the size of matrix I put in:

"the location of the highest horizontal line product is: 5 0 and is the number: 0

The overall max value is 4196352 at the above coordinates."

using namespace::std;
//srand(time(0));
int h_line(int**, int, int);
int v_line(int, int,int);
int diagnol_left(int,int,int);

[Code] .....

View 2 Replies View Related

C++ :: Array Of Structures - Storing Product Information

Nov 5, 2013

I have been dealing with this problem for quite some time, I've been assigned to develop a program that can store products' information within structures (the number of products is undefined). I thought I should use an array of structures, but I don't know how to declare it properly. This is what I thought would work:

struct product {
string name;
string in_stock;
float sale_cost;
int id; }
prod [n]; //n being the undefined number of products the user will register/delete/modify

I already saw an example of array of structures, but it uses a defined number.

View 13 Replies View Related

C++ ::  sorting Ascending Order By According To Product Id / Name / Price

Jul 20, 2014

Here is my code below:

#include<fstream>
#include<iostream>
#include<stdlib.h>
#include<iomanip>
#include<string>
using namespace std;
void main() {
fstream file;
string id,name,type,price;

[code].....

I can't separate and align 4 categories neatly, how to do this solution below(the link of example for sorting Product ID in ascending order): [URL]

By the way,here is the required .txt file(test.txt): [URL]

View 4 Replies View Related

C# :: Retrieving Same Records In The Same Row?

Sep 25, 2014

I have the records "File attached"

My query is

from c in JOB_HISTORies join d in DEPARTMENTs on c.DEPARTMENT_ID equals d.DEPARTMENT_ID select new {d.DEPARTMENT_NAME,c.START_DATE,c.END_DATE}

How do i put the record Accounting in the same row to avoid duplication.

View 4 Replies View Related

C :: Calculate Product Of Two Matrices - Segmentation Fault In Program

Oct 29, 2014

New to C Programming, I have a problem with a little program I made that calculates the product of two matrices.

And here is the error I get:

View 4 Replies View Related

C# :: DLL Passing And Retrieving Data

Sep 18, 2013

I have a C# program going and want to be able to call the DLL and receive back the data requested through a pointer.Below is the DLL import within my C# code.

Code:

[DllImport("MyTest.dll")]
public static extern int ReadNetwork(Byte[] ROM_ID); Below is the code in the DLL Code: int _stdcall ReadNetwork(unsigned char* Array1)
{
ReadDevice(readBackArray);
for(i = 0; i < 20; i++)
{
Array1[i] = readBackArray[i];
}

[code]....

I've tried changing the return values in the DLL's ReadNetwork() function and that works ok, so I know I'm calling the DLL and it runs ok, but printing the result back is where I'm having the problem.

View 2 Replies View Related

C++ :: Retrieving Data From Txt File

Oct 3, 2013

When i execute the program it gets the right data for the first array but the scound either doesn't work at all or just gets to much data. i've tryed using getline and the "cin" for what the file would be in this case "myfile" there is also one more array that must be retrieved from the file.

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

[Code].....

View 4 Replies View Related

C/C++ :: Retrieving Contain Of Array Using Pointer

Nov 30, 2013

I was struggling the last 2 days with this C script supposing to open a list of strings (input as fopen(argv[1])and allowing to access to any element of the list. I created an array *gcm[10000] and a pointer *(*gcm_ptr[10000] = &gcm. However, when I try to list whatever n[i], it always gives me the last entry.

View 4 Replies View Related

C Sharp :: Set Or Specify The Number Of Pages To Be Print?

Feb 11, 2014

I created a richtextbox to input the text that I want to print, the command for printing which is the button and instead of printdialog box((PrintDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)) to be display, I created combobox which will display the available printers and then print.

Like this code bellow .

To get the available printers:

foreach (String printer in PrinterSettings.InstalledPrinters)
{
cbox.Items.Add(printer.ToString());
}

And the button for printing :

PrintDocument1.PrinterSettings.PrinterName = cbox.SelectedItem.ToString();

PrintDocument1.Print();

Now what I want to do is I will add some textbox to input the page number to be printed . For example the current pages in the richtextbox are 12pages when I'm going to run the program I will input in the textbox the page/s that I want like (3-7pages). How could it be ?

View 1 Replies View Related

C Sharp :: How To Count Number Of Lines In XML

Feb 4, 2013

Below is the response XML my programmer is getting from business service -

<Data>
<Maintain>
  <AssetList>
     <AssetDetails>
          <AssetDescriptor> 
             <ns1:ParentProductCat category="ABC">ABC</ns1:ParentProductCat

[code].....

In above XMl if you check the ParentProductCat is prefixed with ns1:,ns2:,ns3:....

My XSLT code only checkes for the ParentProductCat but since it is prefixed with "ns*:" (* is integer) it fails to find it. So that in C# code replace function is used to replace ns*: a for loop is used for this and it goes until 1000

But now my response crossed the 1000 mark and this time the XML contains total 14500 lines.So I want to replace all ns:*

For this I want to count the number of lines present in the XML so that the for loop will run until that line number. how to do that?

View 2 Replies View Related

C Sharp :: Convert Number In Words?

Oct 12, 2013

i want to convert the Digits in words.I have already a code but in my code the value is coming like for ex:-540000(Five hundered and Fourty Thousand ).but i want Five Lakh and Fourty thousand.

View 4 Replies View Related

C++ :: Retrieving Variables From Text File

Apr 18, 2013

I have a text file config.txt which has:

"red = true"
"blue = false"
"children = 10"

I want to write a code that reads the values of these variables red, blue and children when executing the code.

I have something like this:

#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main () {
ifstream Configure;

[Code] .....

I want to read the read the values of red, blue and children in and use them when the program executes.

View 1 Replies View Related

C/C++ :: Retrieving User Input With Getline?

Mar 7, 2015

I'm writing a simple text adventure style program in order to practice C++. I originally used char to get whether the user wanted to go north, south etc, requiring they enter W, A, S, or D, and then I used a switch statement, rather than a bunch of else if blocks to move in the appropriate direction. Last night I started updating the code and wanted to require the user type an actual string like "go north" to move, so I'm in the process of converting it over to getline();.

The way it works is the user will input "go north", and if the string is equal to "go north" it will set a variable to 1, 2, 3, or 4, so I can keep the switch statement. The program compiles but whenever it asks for user input, it always hangs waiting for 2 separate lines of input regardless of whether or not you put a space between your command. The move function is as follows:

void movement() {
bool loop = true;
int roomNorth = 0;
int roomWest = 0;
int roomSouth = 0;
int roomEast = 0;
int dirOption;
string dir = "";

[code]....

I read that it could be an issue with getline and the new line characters, which is why I added the cin.ignore in there...so yea the code will wait for 2 separate lines of input and then always outputs "Invalid direction!" regardless of the input.

View 3 Replies View Related







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