481 Posted Topics

Member Avatar for mikhala99

Looks to me like you only read in 2 numbers from your text file. Then you go ahead and start printing out un initialised memory space.... Chris

Member Avatar for mikhala99
0
130
Member Avatar for Abuzer755

[url]http://www.cprogramming.com/[/url] [url]http://www.cplusplus.com/[/url] [url]http://www.cplusplus.com/reference/[/url] Three nice links thanks will get you started. Chris

Member Avatar for William Hemsworth
0
138
Member Avatar for akim_atl

[icode]srand((unsigned)time(NULL));[/icode] is what most people use if I am correct, I know for sure I have always used it and always will, unless someone puts forward a good argument not to use it. Just remember you only need to call srand() once in your application. Chris

Member Avatar for h3xc0de
0
80
Member Avatar for Stefano Mtangoo

When doing this, the method is normally to have aheader file containing the function prototype. A Cpp file containing the function declaration and the a main cpp file that contains your [icode]int main(int argc, char *argv[]){}[/icode] function, etc etc.[code=cplusplus]//example.h #ifndef EXAMPLE_H_ #define EXAMPLE_H_ int myfunc(int, int); #endif[/code][code=cplusplus]//example.cpp #include "example.h" int …

Member Avatar for Stefano Mtangoo
0
149
Member Avatar for appy33

[QUOTE=skatamatic;785190]Instead use this: [code=cplusplus] cin.ignore(cin.rdbuf()->in_avail()); cin.get(); [/code][/QUOTE] An even better way would be run it from your console/command prompt! Since it's a "console" application! And DO NOT use [icode]system("PAUSE");[/icode]. Not only is it non-portable, but its also a VERY expensive system call! You should probably read the Sticky "How Do …

Member Avatar for Freaky_Chris
0
201
Member Avatar for chrischavez

Well if one was to hide the console window and paint on the main window / active window you could use it in conjunction with something like presentations as a pointing aidor something like that. @marco Thats like saying you should do all DirectX Drawing inside WM_PAINT :)

Member Avatar for Freaky_Chris
0
1K
Member Avatar for CrimsonTider

[code=cplusplus]ostream& operator<<(ostream& os, Book& b){ cout<< "Title: " << "\"" << b.title << "\"" << endl; cout<< "Author: " << b.author << endl; cout<< "Genre: " << b.genre << endl; cout<< "Publisher: " << b.publisher << endl; cout<< "Publication Year: " << b.pubyear << endl << endl; return os; }[/code] …

Member Avatar for CrimsonTider
0
243
Member Avatar for soroushc

Here's some work for you, [url]http://www.cplusplus.com/reference/iostream/stringstream/[/url] [url]http://www.cplusplus.com/reference/iostream/istream/getline.html[/url] [url]http://www.cplusplus.com/reference/stl/vector/[/url] [url]http://www.cprogramming.com/tutorial/lesson3.html[/url] Think that should get you started. Chris

Member Avatar for Stefano Mtangoo
0
167
Member Avatar for TheKebab

[code=cplusplus]encryptedLine += (line.at(pos) + password.at(pos2)); if (pos2 > password.size()) { pos2 = 0; }[/code]You try to retreive the value at pos2 when pos2 is > than password.size() before you reset pos2 to 0. Also the check should be >= or == since if the length of string is 12, then …

Member Avatar for TheKebab
0
165
Member Avatar for xtremerocker

it's your string stream, you need to clear it before adding more to it. [code=cplusplus]OUTPUT.clear()[/code] Chris

Member Avatar for xtremerocker
0
121
Member Avatar for neoangin

[QUOTE=neoangin;796713]omg, I am using Visual C++ 2008 Express Edition "Resource Editiong is not supported on the Visual C++ Express SKU" :( Thanks anyway.[/QUOTE] EDITING is not supported, you can still use .rc files lol, just if you want to use VISUAL resources then you have to make the in external …

Member Avatar for Freaky_Chris
0
87
Member Avatar for datenshi

Can't see exactly what you are doing wrong, partly because i prefer having function definitions split from the class prototypeing. However you have a function [icode]void book()[/icode] now, i'm curious as to what this is supposed to do, since you never call it; yet it looks to me as though …

Member Avatar for Freaky_Chris
0
171
Member Avatar for winrawr

[URL="http://www.letmegooglethatforyou.com/?q=C%2B%2B+DLLs"]One is even on C++ DLLs with VB![/URL] Chris

Member Avatar for Freaky_Chris
0
91
Member Avatar for CPPRULZ

[code=c]void *malloc ( size_t size );[/code]This is the function prototype, and as Agni stated it returns a void pointer. Since this is the function prototype you do not use this syntax when calling the function and infact you use the syntax you originally posted. Here is a small example[code=c]int q …

Member Avatar for Narue
0
380
Member Avatar for rajenpandit

Be sure to make sure all of the files are in the same project, not indervidual just indervidual files, otherwise the compiler will not know to use myfile.c. Chris

Member Avatar for Freaky_Chris
0
92
Member Avatar for gshock2006

[code=cplusplus]if(!inClientFile)[/code]Please do not use this method, it is so wrong. You would be better using the following[code=cplusplus]if(!inClientFile.good())[/code]Chris

Member Avatar for gshock2006
0
245
Member Avatar for williamjoseph

A) We do not do work for you. B) Do not use "Fakse" Signatures C) Do not advertise D) Read the forum rules E) Come back after doing these with a code attempt. Chris

Member Avatar for ithelp
0
145
Member Avatar for ACRobison02

You need to make your constructer call for the Movie class match the constructor definition for starters. Your displayInfo() and searchList() functions in there prototype do not state they accept an array of of the structure Movie, but they do in their definitions. Chris

Member Avatar for ACRobison02
0
121
Member Avatar for gulad75

Please use [noparse][code=cplusplus][/code][/noparse] tags. You need to learn how to call functions since from what I can see you have no idea. I suggest going over the basics again before attempting to carry on. Chris

Member Avatar for Freaky_Chris
0
184
Member Avatar for k88joshi
Member Avatar for odonal01

Read the forum rules, read a C++ book, read previous threads, just read something! Chris

Member Avatar for Nick Evan
0
141
Member Avatar for pcongnu

Would you not be better of using strings in the modern world of C++ or is this an assignment? Sorry to ask this just don't wanted to go into this method if we can just use strings :) Chris

Member Avatar for galin
0
92
Member Avatar for MyRedz

[QUOTE=FrancisC07;792470]for your q1 this is the code that will reverse the digit.. 3 integers, you should modify this to 5 digit.. [CODE]temp=x; x=z; z=y; y=temp;[/CODE][/QUOTE]This is a bad solution, you should not do it this way as this relies on you know A exactly how many digits will be entered …

Member Avatar for arun_lisieux
0
139
Member Avatar for Demonisya

your desciption indicates that you will be given a list of random numbers that will be in no particualr order. thus you cannot just loop through the array backwards. You will need to perform some form of sorting algorithm such as a [URL="http://en.wikipedia.org/wiki/Bubble_sort"]Bubble Sort[/URL] Chris

Member Avatar for its.romi
0
411
Member Avatar for jorgeberber

What agni is suggesting is you do something like this, and then do a search on the name for the inputted name and output the corrisponding number.[code=cplusplus]#include <iostream> #include <vector> #include <fstream> #include <string> #include <sstream> using namespace std; struct data{ string name; int number; }; int main(void){ vector<data> FileData; …

Member Avatar for jorgeberber
0
135
Member Avatar for rosenberg_a
Member Avatar for Ancient Dragon
0
152
Member Avatar for ishaanarora

Think about all the things you have been taught in you're course so far. Think about where you excel in programming then develop smaller projects you have already completed into a monster project. That way you won't be wondering completely into the dark.... Chris

Member Avatar for Freaky_Chris
0
120
Member Avatar for yasserovic

[icode]char name[5];[/icode] 5 is the number of elements you get 0..4 Chris

Member Avatar for Murtan
0
183
Member Avatar for ejubenville

crazyness but [code=cplusplus]fsync(fileObject.rdbuf())[/code] would it not be something silly like that? EDIT: Nevermind previous was a much better answer[/EDIT]

Member Avatar for Freaky_Chris
0
3K
Member Avatar for 3pid

Re-word: He like many others does not trust exectuables presented to them from foreign, unknown sources on a programming website.

Member Avatar for 3pid
0
231
Member Avatar for d4diaz

I'm guessing from the PM you sent me, before creating this thread you found my code snippets. Why don't you look at those as a starting point. Also why didn't you follow the poliate adive I gave you of posting your attempt? Since it is rare i respond to PM's

Member Avatar for Freaky_Chris
0
89
Member Avatar for greenbluekidz

You could use [URL="http://www.cppreference.com/wiki/io/sstream/start"]stringstreams[/URL] to convert the string into an integer. Or you could use atoi() or even better strtol() you can research all of these on the nternet, they are all well documented, if you are still stuck then get back to us. (String streams would be the best …

Member Avatar for greenbluekidz
0
139
Member Avatar for Dendei

Post a sample of your input file and a sample of what your output should be, and what output you are getting please. Chris

Member Avatar for Freaky_Chris
0
105
Member Avatar for azwraith69

[code=cplusplus]#include <fstream> #include <string> int main(int argc, char *argv[]){ std::string example = "Hello, world!\nHow are you?\n\tSuper thanks!"; std::ofstream exfile("test.txt"); if(!exfile.good()) return 0; exfile << example; exfile.close(); return 0; }[/code]I see no whitespace problem...[code=test.txt]Hello, world! How are you? Super thanks![/code]Chris

Member Avatar for azwraith69
0
163
Member Avatar for veer123

You could always write your own implementation....that way it would only use things avaliable to you in the STL Chris

Member Avatar for veer123
0
150
Member Avatar for Medix

Do some research on google, then come back with yuor findings and we will spread some more light on it, but it sounds to me like a homework question and you are looking for a copy and paste answer! Chris

Member Avatar for Medix
0
90
Member Avatar for Stefano Mtangoo

You may find this helpful [url]http://www.voidspace.org.uk/python/movpy/movableidle.html[/url] Chris

Member Avatar for Stefano Mtangoo
0
392
Member Avatar for gamerprog

You're still calling srand() more than once. Also try indenting your code and you might see your problem! Or at least stand a chance, thats too painful to try and read tbh. Chris

Member Avatar for Murtan
0
2K
Member Avatar for ademsaykin

[code=cplusplus]if (h < 0) { return 1; // error code +1 = underflow hours } else if( h > 59 ) { return 2; // error code +2 = overflow hours }[/code]:)

Member Avatar for Murtan
0
188
Member Avatar for clutchkiller

[url]http://msdn.microsoft.com/en-us/library/aa364946(VS.85).aspx[/url] :) or you could probably count the number of characters in the file in binary mode the multiple it by 8??

Member Avatar for William Hemsworth
0
91
Member Avatar for Corus
Member Avatar for noodlecode

You can check out the [URL="http://msdn.microsoft.com/en-us/library/aa383749(VS.85).aspx"]Win32 Reference at MSDN[/URL] too. You might find these links quite nice though. [url]http://www.winprog.org/tutorial/[/url] <-- Very well known [url]http://www.relisoft.com/win32/index.htm[/url] <-- Highly vetted for Chris

Member Avatar for mostermand
0
85
Member Avatar for serkan sendur

You should have all prototypes in the header file and the full function delarations in the external file. Chris

Member Avatar for serkan sendur
0
81
Member Avatar for jdm

please use [noparse][code=language][/code][/noparse] tags. This is possible, create a string with the path and extension such as this [code=cplusplus]string path = "C:\\"; path += (rand()%5+1)+'0'; path += ".jpg";[/code]Build your entire system expression like that, and then pass it like this [icode]system(path.c_str())[/icode] Chris

Member Avatar for Freaky_Chris
0
195
Member Avatar for shadowlord1234

Ask whereever you got the mod from, we know nothing about this.

Member Avatar for Freaky_Chris
0
68
Member Avatar for Dendei

I would do something like this, [code=cplusplus]#include <iostream> #include <string> #include <sstream> #include <vector> #include <fstream> using namespace std; struct cell{ int value; string pos; }cellData; int main(void){ ifstream ins("example.txt"); if(!ins.good()) return 0; vector<cell> data; string line; istringstream iss; while(getline(ins, line)){ for(int i = 0; i < line.length(); i++) if(line[i] …

Member Avatar for Dendei
0
231
Member Avatar for AdRock

Perhaps we could welcome him to the world of C++, rather than staying in the dark ages of C. Vectors, as have already been suggested would be a better approach....as would stringstreams.[code=cplusplus]#include <iostream> #include <fstream> #include <vector> #include <sstream> #include <string> using namespace std; int main(void){ ifstream data("test.dat", ios::in); string …

Member Avatar for Murtan
0
2K
Member Avatar for Aundrey

Sounds to me like you need to do some work yourself. I'd start by Googling Permutations. Chris

Member Avatar for Nick Evan
0
141
Member Avatar for daviddoria
Member Avatar for harryoma

So [code=cplusplus]if(result > 99999) return 0;[/code] *mumbles about multiple exit points* Chris

Member Avatar for harryoma
0
195

The End.