Forum: C++ 1 Day Ago |
| Replies: 7 Views: 153 Your head is wrapped around it wrong. I don't know how you got 19 mpg -- 160.9/3.27 is 49, not 19. |
Forum: C++ 1 Day Ago |
| Replies: 2 Views: 110 string resides in std namespace and you have to tell the compiler what namespace it's in. You have several options (use only one of the options listed below)
using namespace std; put that after... |
Forum: C++ 3 Days Ago |
| Replies: 6 Views: 140 You must be using old version of visual studio. The current version does not use pointers, but the ^ operator
List<String^>^ List1 = gnew List<String^>;
// etc
Upgrade to either 2008 or... |
Forum: C++ 3 Days Ago |
| Replies: 9 Views: 202 line 105: >> else if (j = 51)
You are using the wrong operator. Use boolean == instead of assignment = operator. |
Forum: C++ 4 Days Ago |
| Replies: 4 Views: 125 The value could be anything -- I got 23 with vc++ 2008 express and 3346328 with Code::Blocks (MinGW). It all depends on what was in that memory location. |
Forum: C++ 4 Days Ago |
| Replies: 4 Views: 125 No.
Proof:
int main()
{
int* n = new int;
cout << *n << "\n";
} |
Forum: C++ 7 Days Ago |
| Replies: 2 Views: 165 Did you try deleting all object files and recompiling everything? If that doesn't work then post the offending source file. |
Forum: C++ 7 Days Ago |
| Replies: 2 Views: 179 There are no standard C or C++ functions that will do what you want. Bu8t there are some non-standard functions in conio.h, if that has been implemented by your compiler. You could also probably... |
Forum: C 7 Days Ago |
| Replies: 2 Views: 232 Function add() -- second parameter must also be passed by reference. You are just passing the pointer by value, which does nothing in main()'s copy of the pointer. Note the second parameter should... |
Forum: C 8 Days Ago |
| Replies: 5 Views: 289 1) you failed to read Aia's comment.
2) The printf() statement is incorrect. %s is for a charcter array, shape is not a character array. What you want os %c |
Forum: C 8 Days Ago |
| Replies: 5 Views: 289 >>if (length=breadth)
you are using the wrong operator -- use == boolean operator instead of = assignment operator.
>> shape= 'square';
Two problems with that line
All strings (two or... |
Forum: C++ 11 Days Ago |
| Replies: 9 Views: 299 void swap(int* int1, int* int2)
{
int temp = *int1;
*int2 = *int1;
*int1 = temp;
}
void sort(int int1, int int2, int int3)
{ |
Forum: C++ 11 Days Ago |
| Replies: 5 Views: 307 better off replacing that fprintf() with c++ fstream class so that the compiler won't complain so much. |
Forum: C 11 Days Ago |
| Replies: 10 Views: 451 Why did you use fgets() instead of fscanf()? fgets() gets the entire line without regard to spaces, which is not what you want. Look at the simple code I posted, it does what you need. All you... |
Forum: C++ 11 Days Ago |
| Replies: 9 Views: 299 Its a lot easier to sort them if you use an array of 3 integers instead of 3 individual variables.
int arry[3] = {0};
for(int i = 0; i < 3; i++)
{
cout << "Enter an integer\n";
cin >>... |
Forum: C 11 Days Ago |
| Replies: 14 Views: 623 Yes. Its not really all that big a deal since the program has reserved space for the data anyway. Even though you have the arrays declared in if statements the compiler will allocate memory for all... |
Forum: C 11 Days Ago |
| Replies: 10 Views: 451 >>The program is supposed to take in a file provided through standard input
That means get the name of the file from standard input, not the lines of the file. You have to open the file and read... |
Forum: C 11 Days Ago |
| Replies: 14 Views: 623 Yes it does work.
Read the file into the array just like it was any other normal text file. |
Forum: C 11 Days Ago |
| Replies: 14 Views: 623 >>Is there anyway to achieve this?
No because the #inc lude directive is processed at compile time, not runtime. |
Forum: C 13 Days Ago |
| Replies: 8 Views: 380 In that case go back to the code you originally posted here. inportb() only takes one parameter. It returns the byte read. |
Forum: C 13 Days Ago |
| Replies: 8 Views: 380 Does it use memory models, such as small, medium, compact and large? If yes, then it is a 16-bit compiler. |
Forum: C 13 Days Ago |
| Replies: 8 Views: 380 Yes, the 0x03f8 is the com port address for MS-DOS 6.X operating system. If you read through the links I posted you will find examples how to open the com port.
Are you using the 16-bit version... |
Forum: C++ 13 Days Ago |
| Replies: 3 Views: 261 you never implemented the class constructor. |
Forum: C++ 13 Days Ago |
| Replies: 11 Views: 527 The problem is that you are leaving the '\n' in the input buffer before calling getline(). call ignore() just before getline()
if(savedGame.is_open())
{
savedGame >> stamina;... |
Forum: C++ 13 Days Ago |
| Replies: 3 Views: 232 Bad idea. strtok() will crash the program you posted because it will attempt to change the string literal. |
Forum: C++ 13 Days Ago |
| Replies: 4 Views: 442 >> How to compare file creation date and current system date
I would probably first call GetSystemTimeAsFileTime() to get the current system time into a FILETIME structure. Then just compare the... |
Forum: C++ 13 Days Ago |
| Replies: 3 Views: 232 you want to use the substr() method, not erase(). And delete line 8 because length isn't needed (unless you want to use it somewhere else).
string type = temp.substr(0, pos);
string value =... |
Forum: C 13 Days Ago |
| Replies: 8 Views: 380 you can not use inport and outpout with any 32-bit or 64-bit compiler. Those functions are no longer supported by the operating system. On MS-Windows you will have to use win32 api functions,... |
Forum: C++ 14 Days Ago |
| Replies: 11 Views: 428 1) line 15: you need to check of strtok() returns NULL.
2) line 19: memory leak. You allocated a character on line 17 then toss it away at line 19.
3) line 22: temp has only been... |
Forum: C 14 Days Ago |
| Replies: 3 Views: 246 why the pointers?
int function(user* users, int id, char name[], char surname[]){
strcpy(users[id].name,name);
strcpy(users[id].last,surname);
users[id].id=id2;
}
And in main() you need... |
Forum: C++ 14 Days Ago |
| Replies: 11 Views: 527 Post your text file -- that worked ok for me using vc++ 2008 express. |
Forum: C++ 14 Days Ago |
| Replies: 11 Views: 428 sizeof( any pointer ) is always the same -- sizeof returns the number of bytes it takes to store the address of the pointer, not the length of the string the pointer references. So lines 12 and 13... |
Forum: eCommerce 17 Days Ago |
| Replies: 1 Views: 493 Start here (http://lmgtfy.com/?q=wholesale+fruit+fly+products) |
Forum: Python 17 Days Ago |
| Replies: 12 Views: 307 Is there a question somewhere? |
Forum: Windows Vista and Windows 7 17 Days Ago |
| Replies: 5 Views: 353 See this related thread. (http://www.file.net/process/netfxupdate.exe.html). If the file really is not in the directory you posted then you might need to reinstall the .NET framework. |
Forum: C++ 18 Days Ago |
| Replies: 2 Views: 259 Pretty simple, really
bool Class_name::find_a_record(ifstream& is, string name)
{
Class_name n;
is.seekg(0, ios::begin); // start at beginning of the file
// while not... |
Forum: C++ 18 Days Ago |
| Replies: 4 Views: 442 First you have to get a list of all the files in the folder ( see FindFirst() and FindNext() win32 api functions). Then for each of those call _stat() to get the file creation date and compare that... |
Forum: C 18 Days Ago |
| Replies: 6 Views: 351 Here is how to get a list of the drive letters
#include <windows.h>
#include <iostream>
int main()
{
char buf[255];
char cDrive; |
Forum: C 18 Days Ago |
| Replies: 6 Views: 351 depends on the operating system. |
Forum: C++ 19 Days Ago |
| Replies: 4 Views: 248 try this (http://lmgtfy.com/?q=c%2B%2B+linked+list+tutorial)
In c++ I would use either <vector> or <list> c++ classes instead of creating your own linked list as you might do in C language. |