C++ :: Wedding Reception Data Storage?
Mar 4, 2014
I wanted to store information about a wedding reception and I'm having a few troubles with my program.
#include<iostream>
#include<windows.h>
#include <ctime>
#include<conio.h>
#include<string>
#include<fstream>
using namespace std;
#define on ,
void GREETING();
[code].....
View 1 Replies
ADVERTISEMENT
Sep 10, 2014
I basically want to develop an application which print an existing file on reception of a network event (application will be running on a seven 64 bits PC).
I wonder which application type would be the most suitable (and the simplest) for that (console win32, win32 app, MFC app ...). As this application does not need user intervention (print on network event), I'm not sure that I need a MFC application or a win32 app.
View 9 Replies
View Related
Mar 14, 2013
I have a class that I'm going to use to store a category. Right now there are seven options, but there is the potential for a whole lot more in the future. So I started off by storing an integer as the private member. I then used static constants to define the numeric values to represent each category, then a set of static constant strings that corresponds to those numbers in case I need their actual names. Finally I set up some static functions to convert between the integer value and the string, and vice versa.
I'm not sure if this is the best way to go about this. For one it makes the categories names and designations unchangeable. I thought that storing them in a file would be a better option, but then i needed a container that is the equivalent of a constant.
I thought of defining a class to contain an int and the associated string. It would be designed so that it can only be initialized with both items. Then provide no functionality to change the contents. So I've basically created my own constant.
View 4 Replies
View Related
Jul 12, 2013
I am working on a project and I need to save and work on very big numbers, let me take u an example :
E.g. I want to find the biggest prime number ( 2,3,5,7,... ) but I just know about int, double and etc. which have unlimited storage .
How to save very big numbers on the memory and use them ?
View 5 Replies
View Related
Jan 22, 2014
decalration won't allocate storage, while definition will. This is a test program:
#include <iostream>
using namespace std;
extern int ei;
int i;
[Code].....
Others are all fine in this program except ei.
compiler error: undefined reference to ei.
I understand ei is only declared so there is no memory address, but when I do ei=1, then ei completed it's definition, why still cannot use pei to get it's address?
View 9 Replies
View Related
Mar 23, 2014
I made a program and when I try to use the main driver to instantiate everything it says invalid storage class for a function. All of my code is in 4 separate files i'm just trying to get it to run now.
Code:
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <fstream>
[Code]......
View 1 Replies
View Related
May 22, 2013
Code:
#include <stdio.h>
int sum_array(int * , int );
int main(void)
{
int total = sum_array( (int []) { 1 , 2 , 3 , 4 } , 4 );
}
[code]....
We create an unnamed array "on the fly" that it means array has no permanent storage during the program execution?
View 11 Replies
View Related
Jan 31, 2013
I am porting code from windows using visual studio to mac with xcode.
Quite a lot of issue have a appeared, which is no surprise, one warning that keeps on appearing is Explicit Specialiszation cannot have a storage class:
enum SortReturnCodeEnum {LOWEST=1, HIGHEST=2, HIGHLOW = 3, IDENTICAL=4};
template<typename tKey>
static SortReturnCodeEnum DefaultCompare(typename ArgType<tKey>::ARGT Value1, typename ArgType<tKey>::ARGT Value2)
{
[Code]....
I could do a #define __GNUC__ but i was checking
View 3 Replies
View Related
Feb 15, 2013
Write a program using all storage class specifiers?
View 2 Replies
View Related
Oct 27, 2012
I have a situation where I have two identical storage containers:
Code:
////////////// multiplatform version
union _SOVector3 {
struct { float x, y, z; };
struct { float r, g, b; };
float v[3];
[Code] .....
SOVector3 is part of a namespace with specialized functions that are generic and intended for multiplatform usage.
GLKVector3 is dedicated to the Mac and has its own set of functions.
But what I want to do is freely interchange the storage between these two namespaces. Such as like this:
Code:
start = clock();
SOVector4 myVec4 = SOVector4Make(1.0f, 3.0, 6.0f, 1.0);
SOMatrix4 myMat4 = SOMatrix4Identity;
for (uint i=0; i<100000; ++i ) {
[Code] ....
But I am getting errors when I typecast this.
View 1 Replies
View Related
Feb 14, 2013
So the RPG I have been making is based on this tutorial URL.....I don't entirely understand how the Item storage system is supposed to work. It looks like the array shown is for one item but, there are 3 lines of code that correlate. The author says that this is a repeatable bit of code for each item so.... i'm just completely lost. The player will have two or three to start and there are 4 battle/health items and one key ....
View 2 Replies
View Related
Nov 4, 2014
I wish to read an excel file which contains the table shown at the picture below.
I don't really know how to code the direct storage of the values in the appropriate array.
For example I wish to store the countries in an array of a string type.
could I have some piece of code which illustrates it (I mean the reading of an excel file and the direct storage of his value in an array).
View 1 Replies
View Related
Feb 1, 2013
where to start and how it should be structured. how I should go about writing this program, like should i make functions, pointers, etc. And to display the menu, is it easiest to just use printf statements or is there something more efficient.
View 3 Replies
View Related
Feb 26, 2013
I am writing a code using Visual C++ to access serial port.
Code:
HANDLE hSerial= CreateFile(L"COM1", GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
DCB dcb = {0};
dcb.DCBlength=sizeof(dcbSerialParams);
dcb.BaudRate=CBR_1200;
dcb.ByteSize=8;
dcb.StopBits=ONESTOPBIT;
dcb.Parity=NOPARITY;
I am getting error in all last five lines in above code at dcb. and error is give below:-
Error: this declaration has no storage class or type specifier
View 2 Replies
View Related
Dec 6, 2013
I need to find inverse of a matrix data in binary file should be used to form matrix.its not finding inverse correctly rest is working good.
Code:
#include <stdio.h>
void createbin();
void display();
void inverse();
int main()
{
createbin();
display();
inverse();
[Code] ....
View 4 Replies
View Related
Dec 26, 2013
I am writing a program where I need to read a byte of char data and convert it into a text string of binary data that represents the hex value...
i.e. The char byte is 0x42 so I need a string that has 01000010 in it. I've written the following subroutine....
------------- My Subroutine ----------------------------------------------------------------------
void charbytetostring(char input, char *output){
int i, remainder;
char BASE=0x2;
int DIGITS=8;
char digitsArray[3] = "01";
[Code] ....
When I submitted the byte 0x42 to the subroutine, the subroutine returned to the output variable 01000010... Life is good.
The next byte that came in was 0x91. When I submit this to the subroutine I get garbage out.
I am using a debugger and stepped through the subroutine a line at a time. When I feed it 0x42 I get what I expect for all variables at all points in the execution.
When I submit 0x91 When the line remainder = input % BASE; gets executed the remainder variable gets set to 0xFFFF (I expected 1). Also, when the next line gets executed..
input = input / BASE; I get C9 where I expected to get 48.
My question is, are there data limits on what can be used with the mod (%) operator? Or am I doing something more fundamentally incorrect?
View 6 Replies
View Related
Jul 10, 2013
I have written the following code to add data to text files which are required to store 3D scan data (I have to calculate the y-coordinate). My code seems to work except that it stops working when I want to create more than ten text files i.e. the directory I am trying to store them in will not hold any more than ten text files. Code is shown below.
#include <string>
#include <locale>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
[Code] ....
View 1 Replies
View Related
Apr 19, 2013
I want to input data into text file while not deleting the original data in the file and I use something as
ofstream writefile;
writefile.open("example1.txt");
if (writefile.is_open()) {
for(j=0; j<N; j++) {
[Code] ....
But this will delete the original data.
View 3 Replies
View Related
Mar 28, 2015
#include <iostream>
#include <fstream>
using namespace std;
int main() {
int r = 0;
int c = 0;
int num[17][15] = { 0 };
[Code] ...
// Here is my code for displaying the data from the text file into a 2d array and height next to it, but I am not able to diaplay the height from 60 to 76 next to the row of the 2d array, as shown in the table below. This is my program:
Recently the health authorities have listed a new way to calculate the body mass index (BMI) of an individual.
Values of 20 – 24 are classified as normal, 25-29 as overweight, and 30-34 as heavy.
The table below is a portion of a typical BMI table.
BMI:202122232425262728293031323334
Height:
60102108113118123128133138143149154159164169174
61106111116122127132138143148153159164169175180
.
.
.
MY task is to write a program that does the following things:
1.Produce the table by reading in the data from bmi.txt (on Moodle) into a 2-D array.
2. Display the table neatly on the screen, with row and column headings. The BMI should go from 20 to 34. The height should go from 60 to 76 inches.
3. Prompt the use for their height (in inches) and their weight.
4. Make the program print the closest BMI.
If their weight is lower than the values on the table, use 20 as the BMI.
If their weight is higher than the values on the table, use 34 as the BMI.
5.Loop the program so the user can find more BMI’s.
View 7 Replies
View Related
Apr 20, 2014
Been trying to configure the GridView to display ony 4 rows of data at a time. I thought it wasn't working because I forgot to set AllowPaging to True, but after I did that, I just get the error of
The data source does not support server-side data paging.
Source Error:
Line 66: titlesGridView.DataBind(); // displays query results
Here is my Books.aspx.cs code:
// Fig. 29.11: Books.aspx.cs
// Code-behind file for the password-protected Books page.
using System;
using System.Data.Entity;
using System.Linq;
namespace Bug2Bug.ProtectedContent {
public partial class Books : System.Web.UI.Page {
[Code] ....
Am I missing anything or doing something wrong thats not causing it to page & only display 4 titles at a time?
View 2 Replies
View Related
Apr 26, 2014
I have a situation where I am accessing an ASP.NET Generic Handler to load data using JQuery. But since data loaded from Javascript is not visible to the search engine crawlers, I decided to load data from C# and then cache it for JQuery. My handler contains a lot of logic that I don't want to apply again on code behind. Here is my Handler code:
public void ProcessRequest(HttpContext context) {
JavascriptSerializer jsonSerializer = new JavascriptSerializer();
string jsonString = string.Empty;
context.Request.InputStream.Position = 0;
using (var inputStream = new System.IO.StreamReader(context.Request.InputStream))
[Code] ....
I can call the function : getUserControlMarkup() from C# but I will have to apply some URL based conditions while calling it. The contentType.typeOfContent is actually based on URL parameters.
If possible to send JSON data to this handler then how to do that. I am trying to access the handler like this:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Common.host + "Handlers/SideContentLoader.ashx?typeOfContent=1&UCArgs=cdata");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
But its giving NullReferenceException in Handler code at line:
ContentType contentType = jsonSerializer.Deserialize<ContentType>(jsonString);
View 1 Replies
View Related
Jan 11, 2014
I'm reading from a file the middle column of data (Volts) where my test file "AP.txt" is opened by my program. Here is a segment of the data:
time Volts dV
49552 -66.20183 -0.01556807
49553 -67.76025 -0.01556495
49554 -69.30704 -0.01533247
49555 -70.81799 -0.0148486
49556 -72.26774 -0.0141133
49557 -73.63226 -0.01315276
49558 -74.89141 -0.01201764
Since the calculation I performed gives me -71.77 Volts, I need to match this value to the time that this occurs closest to using my program, and output the time that this occurs at.
Here is my program so far:
int main()
{
std::ifstream inFile;
inFile.open("AP.txt");
ofstream results_file ("maxvaluewithinput.txt");
float TimeAtdVMax = 0;
float VoltsAtdVmax = 0;
[Code]...
If you're curious, this program isn't for homework. It's part of the independent learning on C++ I'm doing for a Master's Thesis; the program will eventually model the APD90 of a ventricular action potential.
View 10 Replies
View Related
Feb 6, 2014
I am wanting to be able to add as many different instances of data, while the user has not stated 'n', but then it only ever writes back to the screen the input for the last set of data. Where as I want to display back to the screen all the data that has been entered.
Code:
#include <iostream>
#include <string>
/*Function Declaration*/
void createItem();
void returnItem();
//Items structure
[code]...
View 6 Replies
View Related
Feb 1, 2015
I'm trying to create a new data type Data declared as int. What comes up to my mind is to create a structure like
Code:
typedef struct Data {
int number;
} Data;
but when I need to use the data I need to go through the structure. Is this a good way to declare a new data type?
View 2 Replies
View Related
Oct 8, 2013
struct receivers
{string fname, lname, team,;
int receptions, yards, TDs, longest,rec20, fumbles, yac, firstdown;
double, averagepergain, averageperrec
}
View 2 Replies
View Related
Jan 30, 2013
I am very very new to C++. A bit of background. I have been writing in excel vba for large number crunching, and the code is now taking quite a while to run. A friend of mine suggested i start writing in C++, so i read up on it. And downloaded Code:Blocks.
My VBA Code is:
Sub arrayss()
Dim NameArray As Variant
Dim datarray As Byte
Dim DirectionArray As Variant
Dim WinArr As Variant
[Code] .....
Ultimately i would like to recode this to C++, but my first and probably silly question is how do i get the data from Excel to use in C++. I was thinking either to put the data in 3 csv files and convert into three Arrays in C++. Or maybe create a library of the data in C++. Ultimately it is speed i am looking for, so before i start recoding i wanted to start with the best way.
The data is like this in excel: (don't know how to create a table)
ABC DCA GFE THE
15 0 1 0 1
30 1 0 1 0
45 1 1 0
00 0 0 1
15 1 1 0
15 1 0 0 1
15 0 1 1 1
30 1 0 0
45 1 1 1
So the headers would be in one array, the 15's, 30's etc would be in another array and the 1's and 0's and Empty ( i need it to record an empty cell) would be in another array...
View 14 Replies
View Related