C++ :: How To Search A Chemical Name Info By Symbol

Aug 28, 2014

I am completely baffled by bin file read/write and positioning. Here I wish to search a chemical name info by symbol. Here is my struct

struct chemicalElement {
int atomicNumber;
char name[118];
char symbol[3];
float mass;
};

I successfully wrote to file.dat as binary but having problem in reading and searching...here is my func...

void searchSymbol(char sym, chemicalElement chemEl[]){
ifstream binFile;
unsigned short int i=0;
binFile.open("chemicalEl.dat", ios::binary);
if(binFile.good())
cout<<"File read for search"<<endl;

[Code]..

View 5 Replies


ADVERTISEMENT

C++ :: File Info Search?

Feb 27, 2013

I am looking for a way that I could check the information of a folder and a drive, to show the data size and storage amount (KB, MB, GB). This is so that I can compare the size of a folder to the storage capacity of a disk drive.

View 2 Replies View Related

C++ :: How To Access Excel File From A Program - Search It For Data And Return Info

Nov 12, 2014

I have been asked to create a program that accesses an inventory file done in excel, look for a alpha-numeric code, which will be inputed by the user, and return to the user informations related to the position of that code, and informations related to the header of the column in which the code resides.

An example of the function I need the program to perform would be:

User inputs: 1429-R1

And the program returns: Marco's 6A, 8/21/2014, 3/7/2014.

using the following example of file:

Marco's 6A
Assessment 8/21/14 3/7/14
1584-R1 1584-R1 1584-R1
1461-2R1 1461-2R1 1461-2R1
1429-R1 1429-R1 1429-R1

View 1 Replies View Related

C++ :: File Writing - Input Your Login Info And Program Writes That Info To A Text File

Jan 30, 2013

I'm trying to make a program that you input your login info and it writes that info to a text file. Then, later on once I get my problem fixed, the program will read the info to the user. my code is as follows(the input part is a bit lengthy):

// Password Log
#include <iostream.h>
#include <fstream.h>
#include <string>
#include <time.h>
using namespace std;
ofstream login;

[Code] ....

What my problem is when I choose "Input new login info" it automatically inputs I have no clue, and calls next program.

View 3 Replies View Related

C++ :: Search And Find The Shortest Queue And Search After Some Condition?

Mar 7, 2013

I am trying to implement a Task scheduler where i have n number of tasks. The Idea behind my task scheduler is that in a loop of queues of a vector, task should get enqueued to the shortest queue among the loop of queues, which is done by the following code.

#include <vector>
#include <queue>
std::vector<std::queue<int> > q
int min_index = 0;
task t // implemented in the other part of the program

[Code] ....

Next i am trying to extend this paradigm to reduce the overhead time of the scheduler, Instead of searching the shortest queue every time, search after some condition ie. search the shortest queue after 5 tasks gets enqueued to the shortest queue.

i need to do something like this

#include <vector>
#include <queue>
std::vector<std::queue<int> > q
task t // implemented in the other part of the program
while(q[min_index].size()!=q[min_index].size()+5) // check whether current min_index queue's size is increased 5 more times if not goto enqueue

[code].....

View 1 Replies View Related

C++ :: Binary Search And Sequential Search Algorithm

Sep 16, 2013

Write a program to find the number of comparisons using the binary search and sequential search algorithms

//main.cpp
#include <cstdlib>
#include <iostream>
#include "orderedArrayListType.h"
using namespace std;
int main() {
cout << "." << endl;

[code]....

View 4 Replies View Related

C++ :: Binary Search Or Linear Search For 3D Array

Oct 7, 2014

inputting a search array. I tried putting a binary search but I can't get it to work. everything else works up until I put the value I am searching for in the array, then it just crashes.

How it suppose to work: input 2 coordinates with a value each then it calculates the distance between them then it suppose to let user search the coordinates for a value and state if found which coordinate it is at.

#include "stdafx.h"
#include <iostream>
#include <iomanip> //for setprecision
#include <math.h>

[Code].....

View 3 Replies View Related

C++ :: X And O Symbol Generation

Mar 5, 2013

I have program. I need programing one game.

char girl;
char computer;
cout << "Girl choose one of symbol x or o";
so girl choose x.

problem : i need random symbol genetation. so if random symbol are x, than girl start play. if random symbol ar o, than computer start game. who to do this?

View 1 Replies View Related

C++ :: What Is Symbol For Divide

Jan 25, 2013

Whats the symbol for divide In C++

View 10 Replies View Related

C :: Occurring Symbol Per Line?

Dec 17, 2014

I want to get the occurence of the symbol ';' for each line of this C program. I type the name of the file Source.c and try to count the occuring symbol, but i am getting the value for ALL of the ';' for each line.

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>/* For exit() function */
int main()
{
char file_name[150];
FILE *file2 = 0;
gets(file_name);

[code]....

View 2 Replies View Related

C :: Read A String With & Symbol

Nov 26, 2013

Why is this correct?

Code:
char str[10];
scanf("%s",&str);

I knew that when we have strings we should not use & in scanf()...

View 1 Replies View Related

C++ :: How To Output Euro Symbol

Feb 10, 2015

here is the code i have so far, basically you have ti enter a price in pounds and it will convert it to euros. i have got the conversion working i am just unsure how to get the euro symbol for the out put.

#include <iostream>
#include <iomanip>
#include <cassert>
using namespace std;
int main() {
char answer;
float sumInEuros;
int numberOfPrices;

[code]....

View 2 Replies View Related

C++ :: Transfer Info From One File To Another?

Jan 18, 2015

I need to transfer the content from the file text.txt to file sort.txt . The data in the text.txt is "struct" (info about people)but the same data needs to be sorted by the name and sent to sort.txt by using a function .

View 9 Replies View Related

C++ :: Send Info To PHP Webpage?

Jul 3, 2014

I was wondering if there was a way for me to send information, say a username and password, to a webpage via a c++ function. I was unsure how exactly to word it, but I did attempt to google it. Here is an example of what I mean.

App starts -> goes to "Https://www.my-site.com/?user=$username&password=$password" -> username/password is valid -> logs them in on desktop app

I do not know much about php, but I am assuming the ?user=$username is setting a variable, correct? I am familiar with sockets, but it seems using the above method, this could be possible without sockets, would it?

Important part:

That is the method that minecraft uses to login players, the question here is what function could I start to send the desktop app to the webpage.

EDIT:: After looking a little more I find that it is probably not possible without sockets, which is fine; however I don't know how to do it still, I would prefer to not use external libraries, such as Curl.

View 3 Replies View Related

C/C++ :: Getting Specific Info From A TXT File?

Oct 10, 2014

I'm trying to open a text file with the name "text.txt", for the purpose of only displaying in the console an specific part of the text file. For example, if I got "This is a test [TEXT] This is the message that should display [/TEXT] this is the end of the file", I want only "This is the message that should display" to be the output, the thing is that I can't imagine anyway of doing that. what I should do?

View 5 Replies View Related

C++ :: Unresolved External Symbol Errors

Apr 10, 2013

I'm doing a homework assignment where I have to calculate monthly interest from a starting balance. I've pulled several sections of the code from various parts of the book. So my problem may be that I'm not combining them correctly.

I'm getting the following error:
Error1error LNK2019: unresolved external symbol "public: __thiscall SavingsAccount::SavingsAccount(void)" (??0SavingsAccount@@QAE@XZ) referenced in function _main

The ios flags are new to me and that may be part of the problem. As soon as I can get a working program, I'm going to make the starting balance and interest rate user inputs. But I get seem to get past this error.

// Savings.cpp
// Chapter 10_Problem 10.7
#include <iostream>

[Code].....

View 12 Replies View Related

C++ :: Program To Generate Symbol Table?

Mar 10, 2014

Need to create a program in c++ to generate a symbol table of given assembly language program?

View 1 Replies View Related

C++ :: Linked List For Symbol Table

Nov 10, 2013

I am writing a linked list for a symbol table, but im getting a vast amount of errors.

Token.hpp:

#ifndef _Token_hpp
#define _Token_hpp
#include <string>
using std::string;
class Token {
string Type = "",
Name = "";

[Code] .....

View 6 Replies View Related

C# :: EMGU - Small Symbol Detection

Sep 16, 2014

I am trying to find the best way to detect a small symbol such as :

Just for testing features I tried to load these into SURF example that comes with EMGU and it does not pick it up... And I think the technology used for SURF is better for objects with more details and color gradients...

View 8 Replies View Related

C/C++ :: VS Errors - Unresolved External Symbol

Jan 14, 2015

This is a file called namespaces.h

#pragma once
namespace mycode {
void foo();
}

This is a file called source.cpp

#include <iostream>
#include "namespaces.h"
namespace mycode {
void foo() {
std::cout << "foo() called in the mycode namespace" << std::endl;
}
}

When I try to run this code i keep getting these errors;

Error1error LNK2019: unresolved external symbol "void __cdecl mycode::foo(void)" (?foo@mycode@@YAXXZ) referenced in function _mainC:UsersHomeDesktopgameDevWin32Project1Win32Project1Source1.objWin32Project1

Error2error LNK1120: 1 unresolved externalsC:UsersHomeDesktopgameDevWin32Project1DebugWin32Project1.exeWin32Project1

this is a win32 console application, like the books says, the book i am working from that is.

View 11 Replies View Related

Visual C++ :: Exported DLL Symbol Validity

Sep 19, 2013

I'm building a cross-platform library which links to some other 3rd party libraries at run time (i.e. on Windows, the other libs will be available as DLLs whereas on Linux / OS-X etc they'd be shared objects, which are similar). For the sake of argument, one of those libraries is called "jack".

Obviously, our app can't guarantee which version of the other libs will be on the user's system (or even that they'll be installed at all). So our code is littered with statements like this:-

Code:
if (!jack_port_type_get_buffer_size) {
warning << _("This version of JACK is old - you should upgrade to a newer version") << endmsg;
} else {
some_var = jack_port_type_get_buffer_size();
}

We link to the latest version of jack, where that symbol is declared like so:-

Code:
size_t jack_port_type_get_buffer_size();

One problem is that it doesn't even seem to be an exported symbol (although that wouldn't affect the other platform builds). But apart from that, our customer might have an old copy of jack installed or even no copy! We seem to be making the assumption that if our customer has an up-to-date version, jack_port_type_get_buffer_size will be set to a valid address - but in all other case it'll be magically set to zero (there's nothing in our code that sets it to zero).

View 5 Replies View Related

Visual C++ :: How To Add A Symbol Of Function Into File EXP

Nov 27, 2013

If there are two projects A and B. A is created as .dll, while B is created as static library.

project A has a class "classA"
classA: public classB {
public:
testA();
};

project B has a class "classB"
classB {
public:
testB();
} ;

I want to make a symbol of classB::testB() in A.exp (like ?testB@classB@@QAEXXZ), can I do it by using __declspec(dllexport)?

Also if I make classB as a template class, can the symbol of classB::testB() be generated automatically in A.exp when building project A?

View 2 Replies View Related

Visual C++ :: Ambiguous Symbol Error

May 28, 2013

Here is the error I am getting:

1>d: estprojectgdiplusrenderer.h(61): error C2872: 'Font' : ambiguous symbol
1> could be 'c:program files (x86)microsoft visual studio 10.0vcincludecomdef.h(312) : Font'
1> or 'c:program files (x86)microsoft sdkswindowsv7.0aincludegdiplusheaders.h(244) : Gdiplus::Font'

How can I fix this issue?

View 2 Replies View Related

C :: How To Read Info From Text File

Jan 8, 2014

I'm a beginner at programming and I'm not sure how to read in information from a text file. What I want to do is take a text file which contains around 20 rows and 3 columns of numbers, and put these into an array which can then be used for performing calculations. How do I do this? Would I need to declare the size of the array beforehand? When accessing my file, do I include the full address?

The relevant part is lines 29-33:

Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/* this is a simpllified code using BEM equations */
main()

[Code] ....

View 13 Replies View Related

C :: Why Can't Get Info From Text File Correctly

Dec 21, 2013

the info gotten from the text file are all wrong, i can't find any problem with my code,

Code:

#include<stdio.h>
FILE *f;
typedef struct prd {
char name[30];
char code[30];
char idt[30];
float price;

[code]....

View 7 Replies View Related

C++ :: Inheritance Info Lost In Container?

Sep 16, 2013

Code mostly speaks for itself:

#include <list>
#include <iostream>
using namespace std;

[Code]....

I added an object of class myderiv to the container, but when I retrieve it back and try to manipulate it, it's actually of class mybase. Is there any way to keep the inheritance information in the container?

View 8 Replies View Related







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