49,761 Topics
| |
how to find length of a character string without using while loop or user defined function? | |
Hi there, i was trying to make a program (to do)using list class here is the code #include<iostream> using namespace std; #include<list> #include<string> void display(const list<string>& lsy){ list<string>::const_iterator iter = lsy.cbegin(); int i = 0; while (iter != lsy.end()){ cout <<++i<<"- "<< *iter << endl; ++iter; } } void add(list<string>&ls){ … | |
The user is asked to input a number in either Hex, Octal or Decimal, which is then converted to Hex, Octal & Decimal. The user can exit the program from the MAIN MENU or by the Escape key after each convertion. Compiler : Borland Turbo C++ v4.5. | |
Hello I am having some trouble with something. As I read the contents of a file into an ifstream object I occassionally want to dump all its contents into a stringstream to analyse it. Example below. The problem I am having is that if I use ifstream.rdbuf() to dumpt the … | |
Having a hard time trying to wrap my head around why my grid system fails, I'm assuming my train of thought is stuck at the moment(akin to writers block). My understanding of grids is while the current cell isn't the last one in the column/row(w/e is horizontal) /*do stuff*/ then … | |
Is it possible to stop the lets say for loop with a function : for(int i = 0;i<15;i++){ cin >> input; obj.add(input); } // and then have some add or some other function that checks if (x == max_size) check(){ if(counter == max_size) stop the foor loop and continue.. } | |
This is driving me nuts. I'm writing a password program that reads from .txt file into an array of char arrays, and then allows the user to write a new password and then appends it to the end of the list. Everything SEEMS to be working except everytime I run … | |
i'm build a completed new code for properties: #include <iostream> #include <functional> using namespace std; template <typename T> class property { private: T PropertyValue; //i think these is ok, but something seems not std::function<T(void)> getf; std::function<void(T)> setf; public: property() { getf=NULL; setf=NULL; }; property(T value) { PropertyValue=value; }; property(std::function<void(void)> GetFunction=NULL,std::function<T(void)> … | |
i put an image on form with WM_PAINT message. but the image is, only, showed after resize(for example) the form. why is that? did i forget any style\extended style? | |
Hello programmers! I am working on a custom tree class [with the code example being copied from Dietl's C++ How to Program, 9th edition]. It is in my fashion to copy all the code examples in the book when reading it (for muscle memory), but the authors created a custom … | |
It's a code to calculate age from today's current date. I know I'll have to use #include <ctime> But I have no idea what I would use for the rest. Here's my code: package practicing; import java.util.Calendar; import java.util.Date; import java.util.Scanner; public class FindRelativeAge { private static Calendar calendar = … | |
Hi programmers! I am trying to grasp the concept of friendship. Let's say that we have the following: class List; //forward declaration class ListNode { friend class List; //make List a friend /* rest of code here, blah, blah, blah. */ } Does this mean that ListNode can access Lists's … | |
heres a nice tutorial about regions: http://www.flipcode.com/archives/Win32_Window_Skinning.shtml like you see, these tutorial is for forms.. so how we can do with child controls!?! we can: add the WS_CLIPCHILDREN or WS_CLIPSIBLINGS style, when we create a button\other control: hwnd = CreateWindowEx( 0, TEXT("CBUTTON"), strCaption.c_str(), WS_CHILD | WS_VISIBLE | BS_TEXT | WS_TABSTOP … | |
Hello everyone! I am in need of some help with a homework assignment. It's basically creating a file indexer using C++. I have 2 separate files that I need to read in: one is a text document and the other is a Skip words key. I am incredibly confused about … | |
The MilTime class should convert time in military (24-hour) format to the standard time format used by the Time class. Theclass should have the following member variables: milHours : Contains the hour in 24-hour format. For example, 1:00 pm would be stored as 1300 hours, and 4:30 pm would be … | |
> Not sure why do I always get a 0 from the isvalidReal function? int isvalidReal(string signedNum) { bool check; int i = 0, j = 1; string str = "+-."; for (i = 0; i <= signedNum.length(); i++) { if (isdigit(signedNum[i])) { check = 1; } else if (signedNum[0] … | |
I posted a simliar issue ealier, but I've changed my approach since then. #ifndef TIME_H #define TIME_H class Time { public: Time(int = 0, int = 0, int = 0); ~Time(); int hour; // valid values are 0 to 23 int minute; // valid values are 0 to 59 int … | |
I'm writing a program to parse a user entered string. My textbook does not include the .find() function, but I found it in an old C++ book (Ivor Horton's Beginning C++, the Complete Language) is the .find() considered bad, or depricated? It seems to work really well, but I don't … | |
> The following letters are stored in an alphabet array: B, J, K, M, S, and Z. > Write and test a function named adlet(), which accepts the alphabet array and a new letter >as arguments, and then inserts the new letter in the correct alphabetical order in the array. … | |
Guys, In below code after reading string values from vector , I can have output like("VarID","flag","count") for(int i=0; i < v.size(); i++){ cout<<v[i]<<endl; } All are (varID,flag and count)are string literal , now i need to populate the structre with this string literal. where VarID = int,flag=bool, count=Int. Can anybody … | |
Guys, In below code they are couple of issues. (1) I am not able to read first key and value pair record from snmp.json file in my map, it just start reading after first record. (2) After reading the value from file in current implementation it is not reading the … | |
How to play a sound file in c++. I am trying to make an alarm program. I've done everything but i need to play sound at certain time. please help.............. | |
Hello, I am currently working on a binary search tree that acts as a phone book. I am nearly completed with it and all functions seem to work properly except in two cases: An error message will not print to the screen when trying to delete or edit for a … | |
Hi every one, Can any one tell me the major difference between JAVA and C++... | |
[Click Here](http://s8.postimg.org/ab4paaq8l/New_Bitmap_Image.png) is adding m_y, m_m, m_d, considered as cheating? if not, how to get the value for getYMD()'s param? | |
I am looking for a simple c/c++ code that converts 16b-greyscale image to raw format using tiffio.h?. | |
Hi, I want to show/hide my MFC Dialog from another class; Main App : HomeWorkApp Main Dlg : HomeWorkDlg #include "HomeWorkDlg.h" #include "HomeWorkApp.h" CWorkUser::CWorkUser() { // Initialize MFC Dialog here.. // How ?? MainDlg->ShowWindow(SW_SHOW); } CWorkUser::~CWorkUser() { // Finalize MFC Dialog here.. } Thanks.. | |
Hello! I was creating a custom array class as an exercise in my exploring of class and function templates. Here's my header file: #include <iostream> template <typename el> class Array { friend std::ostream &operator<<(std::ostream&,const Array&); friend std::istream &operator>>(std::istream&,Array&); public: Array(const int& arraySize=0); //set all members of array with size arraySize … | |
All A template function must have at least ---------- generic data type 1Zero 2one 3two 4 three witch is answer is correct? | |
Use a DO WHILE loop |
The End.