C++ :: In What Type Intermediate Result Of Expression Is Stored

Jan 8, 2013

my doubt is :- in what data type the intermediate result of an expression is stored? like for expression 2+3*1/2 , i think the intermediate result for 1/2 is stored in the form 0.5 but for expression 2+3*1/100 , i think the intermediate result for 1/100 is stored in the form 0.01 so i am not sure if the compiler use dynamic type ie, changes with need. or it always stores in high precision like:- for 1/2 its 0.5000 and for 1/100 also 0.0100 or something like that.

View 4 Replies


ADVERTISEMENT

C# :: Using Dataset Result As A Variable In A Stored Procedure

Aug 6, 2014

I'm trying to pass one dataset's result as a variable in another stored procedure and this is what I have so far:

DataSet dsID = StoredProcedures.GetID((int)Session["TypeID"]);
int IDValue = Convert.ToInt32(dsID.Tables[0].Rows[0]["ID"]);
DataSet dsRequest = StoredProcedures.GetRequest(IDValue);

But I get the error: cannot implicitly convert to system.dataset.

View 1 Replies View Related

C++ :: Expression Must Have A Class Type?

Apr 3, 2014

I am making a program that allows you to add two big numbers that are larger then what int can handle together. I think I have done everything to accomplish this but when I try to instantiate the program I get a error Expression must have a class type.

Here is my main file that is supposed to instantiate the program.

Code: #include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <conio.h>
#include "LargeIntegers.h"
using namespace std;

[code]....

View 10 Replies View Related

C++ :: How To Find Expression Must Have Class Type

Oct 2, 2013

#include<iostream>
#include<math.h>
#include<string>
using namespace std;
class houseinfo{
private:
string name;
string address;

[Code] .....

View 2 Replies View Related

C++ :: Error / Expression Must Have A Class Type

Apr 15, 2015

I'm trying to learn recursion, and I'm using a simple array to experiment with it, but I have a couple of annoying errors that I don't understand why they're there. Here's the code:

Code:
#include <cstdlib>
#include <iostream>
using namespace std;
int largest(const int arr[], int lowerIndex, int upperIndex) {
int max;

[code]....

Now try to print the array backwards:

//Use a recursive algorithm to find the largest element in arr:
int largest(arr[], lowerIndex, upperIndex);//error: expected an expression
return 0;
}

View 14 Replies View Related

C/C++ :: What Data Type Is The Result Of Calculation On Int And Double

Jun 24, 2013

okay for instance
int x = 4;
double y = 2;  
printf("%d", (x / y + 5));

what data type is
(x / y + 5)
??

View 3 Replies View Related

C++ :: IntelliSense - Expression Must Have Integral Or Unscoped Enum Type

Sep 6, 2014

So far I have the following code:

// Purpose: To write a program that displays the number of millimeters higher the current level the ocean level will be in
// in 5, 7, and 10 years.

# include <iostream>
# include <string>
using namespace std;
int main() {
float X = 10;
string Y="";

[Code] ....

But I get the following error message:

IntelliSense: expession must have integral or unscoped enum type

three times in a row for lines 25, 27, and 29 and I don't understand or know why?

In case the purpose does make sense here are the directions:

2.7: Ocean Levels

Assuming the ocean’s level is currently rising at about 1.5 millimeters per year, write a program that displays

•The number of millimeters higher than the current level that the ocean’s level will be in 5 years,
•The number of millimeters higher than the current level that the ocean’s level will be in 7 years,
•The number of millimeters higher than the current level that the ocean’s level will be in 10 years,

Output labels:

Each value should be on a line by itself, preceded by the a label of the form:

In X years the ocean's level will be higher by Y millimeters.

where X is the number of years (5, 7 or 10) and Y is the value you calculate.

View 16 Replies View Related

C Sharp :: Data Type Mismatch In Criteria Expression?

Feb 12, 2013

I am firing an insert query like this in C# to MS ACCESS 07 Database

var expiry = dateTimePicker1.Text;
 string instr = "insert into MST_QUOTATION values(";
instr += txtID.Text;

[Code]...

data type mismatch in criteria expression

View 2 Replies View Related

C :: Calculate Number Of Bits In Type - Incorrect Result In Program

Feb 15, 2014

I have this simple program below:

Code:
#include <stdio.h>
#include <limits.h>
unsigned int rightrot(unsigned int x, unsigned int n) {

/* calculate number of bits in type */

size_t s = sizeof(x) * CHAR_BIT;

[Code] ....

The result it prints is 2684356604 on my 32-bit computer. The result I expect is as follows:
0xFF94 is 0000000000000000 1111111110010100 in binary.

Shift it right by 5:
0000000000000000 0000011111111100

Then take that result in shift it right by 27 (s is 32 and p is 5, so the difference is 27):
1111111110000000 0000000000000000

Now we use bitwise or:
0000000000000000 0000011111111100 | 1111111110000000 0000000000000000 = 1111111110000000 0000011111111100

That in decimal is 4286580732. So how does it come up with 2684356604?

View 2 Replies View Related

C/C++ :: If Statement Only Evaluates With Intermediate Variable

Jul 10, 2014

Odd problem.

if (n <= a.size())
{
evaluates false, despite n being -1 and a.size() (where a is a std::map) being 2913
int test = a.size();
if (n <= test)
{

evaluates true. why does the first one not work?

View 2 Replies View Related

C++ :: Intermediate Input / Output Buffer For Objects

May 6, 2014

The documentation of the class filebuf in the reference of cplusplus.com says:

Objects of this class may internally maintain an intermediate input buffer and/or an intermediate output buffer, where individual characters are read or written by i/o operations. These buffers are synchronized with the contents of the file once filled up, when explicitly requested to do so (sync), or when the object is closed.

Objects of this class may be explicitly made unbuffered by calling member pubsetbuf with both arguments set to zero (see member setbuf): Unbuffered file stream buffers perform the i/o operations directly on the file, without an intermediate buffer.

The C++ standard ensures that filebuf objects have an intermediate input/output buffer/s (i.e, the default constructor of the class filebuf creates the intermediate buffer/s)?

The standard C++ library only allows unbuffering filebuf objects (as the above quote says) but doesn't allow forcing filebuf objects to be buffered.

I have been seeying the concrete implementation code of the standard C++ library in my Windows Operating System (Windows 7 Ultimate 64 bits Service Pack 1) and it seems that fielbuf objects never uses intermediate input/output buffer/s, they use FILE streams of the standard C library instead to do the work. Are this FILE streams always buffered? If true, are they fully-buffered or line-buffered? what is the size of the buffers (perhaps macro BUFSIZ from <cstdio>)? and can I change this size?

I am worried about performance in reading and writing from/to files: if the default behaviour offers the best performance (perhaps if files are too large is better force buffering and choose a larger buffer size).

View 2 Replies View Related

C++ :: Intermediate File Multi-process Safety?

Jul 21, 2012

I have a compressor that takes a file and first compresses it to an intermediate file "temp.lz", before compressing it to the final format. Immediately after that the file be removed by calling c's remove(char*). The problem I am afraid of is if calling this compressor from different processes is safe because of the intermediate file created which has the same name for all. (say temp.lz). Will I have problems when callinga sytem call from different process something like: system ("compress -i test.txt -o test.z") ?

I was thinking of rewriting the compressor to avoid the use of the temporary file but that is a bit awkward. I just need to use a temporary stream (file) different for each process to avoid race conditions.

View 8 Replies View Related

C++ :: Where Mutex Is Stored In Windows

Jan 17, 2013

I want to know how mutex is working in process synchronization. Where these mutexes are stored in memory how another process know about this mutex?

If two different mutexes are having same name what will happen?

View 6 Replies View Related

C# :: How To Using Stored Procedure With Web Grid

Apr 9, 2014

How do you use a stored procedure with a WebGrid? Our coding standard say we cannot write sql statement directly in the code to include HTML.

[var Grid = new WebGrid(DB.Query("Select * from Menu")]

The above call must be a call to a stored procedure.

View 4 Replies View Related

C :: Version Number Stored In EXE File

Feb 24, 2015

I am/we developing in C and we have a number of different programs. We also have problem to keep track of different versions of a specific exe file.

Is there any way to add version number when build a file so the version is added in the properties.

I doing this in a MFC c++ project in a .rc file. Is there a way (or a similar way) of doing this in C? Here its stored in the details section with product version 6.0.8:

View 6 Replies View Related

C# :: Are Methods Stored In Heap Or Stack?

Jan 29, 2012

I know that memory addresses in the stack can contain either values or references to other memory addresses, but do these memory addresses also contain methods or are the methods themselves located in the heap?

The confusion comes from the fact that in C# a delegate variable can be assigned either a method's identifier, an inline function, a lambda expression, or a new instance of the delegate type with the method's identifier passed as an argument to the constructor. My guess is that assigning the method's identifier directly to the delegate variable is just a simplified way of calling the delegate type's constructor with the method's identifier as an argument to the parameter, something that the compiler handles for you.

But even in this last case, the delegate variable is said to point toward the method itself. In that case, does it mean that methods are stored in the heap, just as reference type values are?

View 2 Replies View Related

C :: Can't Print Number Stored In Array

Jan 12, 2015

when i compile and run it it gives me the number 0 and not the proper number stored in array.

Code:

#include <stdio.h>
int main()
{
int myArray[11] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 };
}

[code]....

View 4 Replies View Related

C++ :: How Class Objects Stored In Memory

Aug 23, 2014

For example when I have:

Class A{
B objectB;
};

Now when I instantiate the object of class A like:

main(){
A objectA;//option 1
A* pObjectA = new A();// option2
}

How is objectB stored in memory (stack heap etc.) for both options??

View 1 Replies View Related

C++ :: How To Get User Input To Be Stored In 1 Out Of X Variables

Dec 5, 2013

Making a game of checkers on C++ win32, visual studio

when i want a piece to move, i type:

cout << "What piece do you want to move? (C4)" << endl;

i type in 'cin' after to get the players input, but how do i get it to store the players input in a certain variable? im going to have a list of variables:

string a1
string a2
string a3

etc

so if the user types in a2, it automatically goes to that variable and then asks the user "where do you want the piece to be moved to?".

View 6 Replies View Related

C++ :: Deleting Value Stored Inside One Of Vectors

Feb 11, 2015

So I'm trying to delete a value stored inside one of my vectors but I can't accomplish this. My attempts are down below. I've commented out one attempt since it gives me errors. How can I do what I am trying to do?

#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<vector<int> >row;
vector<int> newColumn;

[Code] ....

View 10 Replies View Related

C++ :: Value Not Stored Into Vector After Reading File

Oct 21, 2013

Reposting this as I deleted my pervious post because I missed out some parts of the codes.

I am trying to read a textfile containing some informations in this format,I am able to extract everything except the itemId.

View 2 Replies View Related

C/C++ :: How To Validate Data Stored In A File

Jun 21, 2014

I am trying to build a employee management system using C, and I have done alot so far. Everything seems to work fine, but then I thought that I should let the user store the data of their employees permanently, therefore I created a file and then I store the user's given data in the txt file.

Here is the code:

#include<stdio.h>
#include<conio.h>
#include<string.h>

[Code].....

But there is some problem, and I don't seem to understand what is the problem in the code, it's just that whenever the user enters any id to search, and presses any key then nothing appears just a blank screen! I wanted to know that how can I check the ID from the text file and then display the details of the employee of that id!

View 1 Replies View Related

C Sharp :: Create Xml File From Xml Stored In A DB

May 15, 2013

I have a table in my database that has a 3 fields.

RuleID | RuleName | Rule

the ruleID is a randomly generated string of characters, RuleName is the name the user gives to the rule, and the Rule field is about 600 characters long and is just XML text.

I want to read that Rule field from the database and use it inside the function below.

private static List<MenuItem> LoadRules(bool evaluationType)
{
//string path = HttpContext.Current.Server.MapPath(string.Format("/Rules/{0}/{1}/", ip, evaluationType ? "Evaluation" : "Execution"));

[Code]...

This function loads an xml file from a static location and parses out some information to a context menu.

BUt i'm culeless on how to have the function read the xml info found inside my database.

View 1 Replies View Related

C++ :: Changing Array Of Numbers Of Type Char To Type Int?

Apr 27, 2013

I'm having some problems with changing an array of numbers of type char to type int. Every time i try to sum 2 array indexed values it returns some letter or symbol. Also, if i change the type of the array in the functions the compiler gives me an error message. I would also like to add that the problem requires that the first two arrays be char so each individual number gets assigned to a different value.

My current code is:

Code:
#include <iostream>
void input(char a[], char b[], int& size_a, int& size_b);
void convert(char a[], int size);
void reverse(char a[], int size);
void add(char a[], char b[], int c[], int size);
int main()

[Code]....

View 4 Replies View Related

C++ :: Convert Element Of Int Type Of Array To Char Type?

Dec 21, 2013

how to convert an element of int type of an array to char type?

View 2 Replies View Related

C++ :: Force Variables To Be Stored In Char Array

Jan 7, 2015

I want to declare a char* array, and then make any future variables declared to be stored in a specific location within the char* array. Is this even possible, and if it is how would I go about doing it. (I plan on storing any primitive data type in it (not classes or structs), and they may signed or unsigned).....

View 12 Replies View Related







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