49,761 Topics
| |
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() … | |
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 … | |
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 … | |
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 | |
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 … | |
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 … | |
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. | |
-------------------------------------------------------------------------------- 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 … | |
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 … | |
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 … | |
Hi All, I want to convert char * to int. Plz help me out. Thanks in advance. | |
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 … | |
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 … | |
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? | |
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 … | |
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(" … | |
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 … | |
hello there, do anybody here have an idea of the Linux version of the GetTickCount() function. thanks! :) | |
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 … | |
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 … | |
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 … | |
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 … | |
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++? | |
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 … | |
[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 … | |
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&)': … | |
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 … | |
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... :) | |
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 … | |
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 … |
The End.