49,761 Topics

Member Avatar for
Member Avatar for jbennet

Okay here is some code I have made: [code] /*============================================= Number Guessing Game Uses the srand() function and loops. James Duncan Bennet - james.bennet1@ntlworld.com ===========================================*/ #include <iostream> #include <cstdlib> #include <ctime> #include <fstream> #include <string> using namespace std; int guess = 0; int tries = 0; string line; int main() …

Member Avatar for jbennet
0
163
Member Avatar for Akilah712

I am working on a project and I need to process a text file. I have read in the text file. What I want to do is break the textfile up. The textfile looks like this: >Name 1 ABCDEF GHIJKLM >Name2 GHIJKLM What I want is to store each name …

Member Avatar for Akilah712
0
281
Member Avatar for Hamrick

I'm writing a doubly linked list and a lot of the code ends up being the same with _next and _prev switched. What can I do to keep from writing some code with _next and then the same code again with _prev? Can I do like a template that flips …

Member Avatar for Bench
0
96
Member Avatar for VISHOWNTAR

Hi, I am new in programming. I would appreciate if anyone can help me out to find maximum value of each column in the following matrix. int array[3][5]={{1,2,30,4,5},{3,41,5,6,7},{5,6,7,81,9}}; Thanks, Vishowntar

Member Avatar for VISHOWNTAR
0
2K
Member Avatar for nabilchampion

Hello to all there I m new to this forum and couldnt find the answer to my question so I am creating new thread for discussion on this topic. Recently I have taken some tests and one of many confusing question was this: "Maximum possible number of nodes in a …

Member Avatar for Ancient Dragon
0
608
Member Avatar for Reg74

Program to demonstrate the Stack class #include <iostream> #include <vector> using namespace std; template<class T> class Stack { public: Stack(); bool empty() const; T top() const; T pop(); void push(T element); void Output(T element); private: vector <T> pool; }; //constructor template<class T> Stack<T>::Stack() { pool.reserve(10); } //function to output the …

Member Avatar for Reg74
0
165
Member Avatar for ejptccs123

Hi, I need to have my compiler take preprocessor definitions from the command line. How does it differ from normal command line parameter passing (main(int arc, char *argv[])) ? Thanks.

Member Avatar for thekashyap
0
168
Member Avatar for Fromethius

-------------------------------------------------------------------------------- When using this with the DrawText API, I make the rectangle that the text is contained in the width of the return value of GetTextExtentPoint32 I know I am using the right parameters, but sometimes the rectangle is way too big (over 15 pixels wider than the actual width …

Member Avatar for Salem
0
184
Member Avatar for tformed

I am making a program where the user has to input text, and the program outputs the appropriate string. I made this program using if else statement, but professor said not to use if and else. So I want to know if I can use the switch statement. I know …

Member Avatar for Killer_Typo
0
4K
Member Avatar for mauro21pl

Hi guys where is the problem with that simple class program: #include<iostream> #include<conio.h> using namespace std; class DayOfYear { public: DayOfYear(int month,int day); void output(); void input(); private: int month_year; int day_year; }; DayOfYear::DayOfYear(int month,int day) { month_year=month; day_year=day; } void DayOfYear::output() { cout<<month_year<<"/"<<day_year; } void DayOfYear::input() { cout<<"What's your …

Member Avatar for ~s.o.s~
0
156
Member Avatar for RohitSahni
Member Avatar for ~s.o.s~
0
32K
Member Avatar for alembic21

Hello All, I am writing a program to act as a cash register. I reads in from a file that looks like this: A Cheeseburger 2.97 B Soda 1.90 C Sundae 3.50 ...and so on..... The point is for the user to enter a single letter and then the item …

Member Avatar for ~s.o.s~
0
79
Member Avatar for Mylena

Hello, Could anybody please advise me where I can find examples of high precision floating operators, where I can clearly see the binary schifts. I've learned binary basics, but I have no idea how to write this High Precision Floating operators. (+,-,*,/,etc). I downloaded GMP library, but it didn't have …

0
58
Member Avatar for tunday

Hi. I need help please on how to convert an array of WideString values to THashString types. I have an array that needs to be added to a THashStringList object. Can someone please help me?

0
64
Member Avatar for gattispilot

I was told not to have global variables and given an example. Ifollowed it and now I get this error:[B]only const static integral data members can be initialized inside a class or struct on lines 50-85 [/B] [code]#define STRICT #define ORBITER_MODULE #define ENG 1 #define START 2 #define STOP 3 …

Member Avatar for gattispilot
0
336
Member Avatar for hendyhanusin

Dear Friend, How to convert these codes into VB .NET ? Tks, hendy =============================== [code=C++] BYTE cmd[NumMsg][7]={{0x00,0xA4,0x00,0x00,0x02,0x02,0x47}, {0x00,0xA4,0x02,0x00,0x02,0x01,0x02}, {0x00,0xB0,0x00,0x00,0xff,0x00,0x00}}; BYTE DataLength, pData[10], ResponseDataLength; BYTE pResponseData[100]; INT16 TimeOut=50, i, CardFrameSize; char pdata[500]; char *ATS_ATQB; CardFrameSize=0; pdata[0]='\0'; ResponseDataLength=0; if (PICC_RATS(rHandle, 4, &ResponseDataLength, pResponseData)>=0) { CardFrameSize=pResponseData[1]&0x0f; } for (i=0; i<ResponseDataLength; i++) { StrMsg.Format(" …

0
75
Member Avatar for RohitSahni

hi any idea about this error. [code] In constructor `local_ExtraLogStreamBuf::local_ExtraLogStreamBuf()': .cc:224: error: `setb' undeclared (first use this function) .cc:224: error: (Each undeclared identifier is reported only once for each function it appears in.) /usr/include/time.h: In member function `void local_ExtraLogStreamBuf::printAtLogLevel(char, const char*)': /usr/include/time.h:250: error: too many arguments to function `char* asctime_r(const …

Member Avatar for RohitSahni
0
124
Member Avatar for jaepi

hello there, do anybody here have an idea of the Linux version of the GetTickCount() function. thanks! :)

Member Avatar for jaepi
0
3K
Member Avatar for tone_crafter

I have a string grid that I am setting the number of rows dynamically. Therefore I am creating an array of TUpDown arrows dynamically and placing one in each cell within a column. My problem is that I want each UpDown arrow to have the same event handler. I can …

0
89
Member Avatar for mauro21pl

Hi What is wrong with that piece of code.Why it doeasn't let me compile. It gives me that errors on Dev-C++ : 15 expected primary-expression before "void" 15 ISO C++ forbids declaration of `privite' with no type 15 expected `;' before "void" In member function `void DayOfYear::input()': 45 `check_date' undeclared …

Member Avatar for Bench
0
140
Member Avatar for hinduengg

Hello once again . My teacher has given us the assignment to enter a string a [B]maximum of 7 charecters[/B] and permute it. Then print all of possible permutations . Like if the inputted word is JAY so Output would be JAY AJY AYJ JYA YAJ YJA I do not …

Member Avatar for hinduengg
0
1K
Member Avatar for Mylena

Hello! I need to invert a 24-bit bmp image from right to left, and from top to bottom. I know how to invert colours, but not the position. I only know fstream to open and close files. This is what I did (below). Please let me know where I am …

Member Avatar for Mylena
0
207
Member Avatar for mouna

Hi, Is any one using an ASN1 PER encoder/decode in C++ ? i am using esnacc v1.7 to encode ASN1 defined data into C++ objects but i am having problems with the esnacc PER encoding functions, has anyone tested esnacc 1.7 or another tool for PER C++?

0
79
Member Avatar for RohitSahni

Hi Guys.. Plz let me know where can i get STL string user guide. and d also if u guys can help me. I want to know is there any method in std::string which can help me convert Lower caase to upper case and vice verssa. Plz help me out …

Member Avatar for Ancient Dragon
0
109
Member Avatar for mauro21pl

[code=cplusplus] #include <iostream.h> #include <string.h> int const MaxSize = 50; Class CString { public: CString ( ); //Constructor initializes array to NULL. int GetStrLen( ); //Gets the length of the string. void ClearStr( ); //Clears the array to NULL. void DisplayStr( ); //Displays the string as written. void SetStrVal(char*); //Assigns …

Member Avatar for Bench
0
181
Member Avatar for RohitSahni

Suppose while converting RWCString constructors to std::string constructors, i am getting following errors. Can anyone please povide me with the Porting Guide for this .error which i am getting : [code] Hash.h:23: error: 'const struct std::basic_string<char, std::char_traits<char>, std::allocator<char> >' has no member named 'hash' COArgs.cc: In member function `void COArgs::readStream(std::istream&)': …

0
82
Member Avatar for mauro21pl

How may I clear whole array in that example? [code=cplusplus] #include <iostream.h> #include <string.h> #include<conio.h> using namespace std; class C_String { public: char* Input(); void Output( ); private: char array[30]; }; char* C_String::Input() { cin.getline(array,30); } void C_String::Output() { cout<<array; } int main() { C_String some_data; char array[30]; cout<<"enter sopme …

Member Avatar for Ancient Dragon
0
83
Member Avatar for jaepi

hello there, can anyone here explain to me and an explanation on the usage of these operators (<< and >>) or point me to any site that explains it very well... thank you... :)

Member Avatar for jaepi
0
95
Member Avatar for mauro21pl

Look at that code How may I aproach that. I would like to print the middle charactert of the string, if the string has an even number character ,I would like to print the right most character on the left half of the string thanks [code=cplusplus] #include<iostream> #include<conio.h> using namespace …

Member Avatar for Bench
0
78
Member Avatar for nautolian

Hi all, I'm really new to programming, but i understand many basics... I have tried to set myself a goal of creating a "smartbot" that can hold a somewhat intelligent conversation with someone. So far, i can get the bot to recognise a name of a person. I've been trying …

Member Avatar for Bench
0
271

The End.