49,756 Topics
![]() | |
I'm a little lost with C++ so I could really use your help with this one! I googled it but nothing does what I want to do! So here is my problem... Let's say I have a file like this: A 10 20 30 40 B 25 13 100 99 … | |
every time i run the program it prints out 0. I think something is wrong with my display function but i cant see the problem. [CODE]#include <iostream> using namespace std; #define STACKSIZE 10 class stack { private: int arr[STACKSIZE+1]; int tos; public: stack(); void push(int x); int pop(); bool is_empty(); … | |
Hello all. I am trying to figure our how to add a pin and unpin button on one of my ms visual forms. An example of this is the pin that in used on the top right of the solution explorer in ms visual. I know that in the basic … | |
![]() | We have been assigned to make a program for a bank using data file handling, as our project. I am having some trouble at this point... the last object written in the file is printed twice and I've no clue as to why. Case for display: [CODE]file.open("Records.dat", ios::in | ios::binary); … |
Sorry for using Inception in the title but it's the only way I think I can describe it.. Take this for example: Definition.H [CODE] struct XY { string info; string name; string tag; string attrib; }; //is it better to create an object here inorder to make the array? struct … | |
hello everyone! i'd like to know if theres a way to run my program until the user presses Esc button. i use linux environment and my main function runs fork().i want the program to stop the fork() when the user presses escape. thank you! | |
I am trying to make a circular linked list and I think I am not linking it properly in the middle area because I can print the last and first node, but not the rest... [CODE]#include <iostream> #include <new> using namespace std; struct node { int Item; node* Next; }; … | |
Please help me run this program, i forgot the output of this.. [CODE] #include<iostream> #include<cmath> using namespace std; class SumTwoNumbers { int nx,ny,sum,suma,sumtn; public: int GetFirstNumber(); int GetSecondNumber(); int GetSum(int,int); void Display(int,int); }stn; int SumTwoNumbers::GetFirstNumber() sum=nx+ny; //here is where the errors i wrote below points! i dont know why return(sum); … | |
I'm trying to implement priority queue using a singly linked list, but the program is not running in the best way, n the display function is showing just first n last node's data , y??? [CODE]#include<iostream.h> #include<conio.h> struct node { int n,p,b; // Data members for getting Task no. ,Priority … | |
Hi, I got this error while trying to access the method that I've posted here. Main program: cin>>sname; string x; Sports x = Sports.getName();//error:a nonstatic member reference must be relative to a specific object. loc=x.find(sname); In Sports.cpp: string Sports::getName() {return name;} I've declared getName() function as public.Still I'm getting this … | |
Hey everyone, I've made a game with SDL and I'm now trying to distribute it. I've included all of the required .DLLs and such but now I get this error whenever I try to run the .exe: The application or DLL E:\GAME\DEBUG\MSVCR100.dll is not a valid Windows image. please check … | |
I'm writing a dayType class program and I'm having trouble with comparing two different days to each other. Here is what I have for them: bool dayType::equalDay(const dayType& otherday) const { } and here is main: if (day.equalDay(newday)) cout << " equal days" << endl; else cout << "not equal … | |
Hey guys, I'm fairly new to C++ and I was wondering if I could get a hand with something. I'm trying to write a program that will create something called an anti-saccade task, in which the subject of the experiment would have to look away from the stimulus, for my … | |
Hi there, I am new to C++, and was wondering if someone could write an example program for me to work with. What I would like to do is take input from stdin and then display the translate output to stdout. Example: Input: [code] (color 0 0 0.1) // These … | |
[code] struct String { String() { std::cout<<"String::String(), this="<<this<<std::endl; } ~String() { std::cout<<"String::~String(), this="<<this<<std::endl; } String(String const &other) { std::cout<<"String::String(String const &other), this="<<this; std::cout<<", other="<<&other<<std::endl; } String& operator=(String const &other) { std::cout<<"String::operator=(String const &other), this="<<this; std::cout<<", other="<<&other<<std::endl; return *this; } }; String const operator*(String const &lhs, String const &rhs) { String … | |
Hye.. Any know to create calculator program for formula V=IR In c++..?? Please help me.. ASAP ![]() | |
Code works, however i'm having problems with reverse string- i cant figure out how to index the elements. for cycle returns errors, what else could i use? The end goal would be to compare string line with string reverse. If adequate elements match its a palindrome. [code=c++] #include <iostream> #include … | |
I have a palindrome set up in the system, and running fine. However, when I type "never odd or even" or "A Man, A Plan, A Canal, Panama", it didn't run properly as if these words in quotation marks are considered palindromes. Where is the loophole on my code re: … | |
I have a problem to test endiness of c++ code . It contain around 170 files. How to check that whole code is bi-endian ? | |
I saw this example while i am searching about vectors.. [CODE] vector<double> student_marks; // no size specified: vector contains // no elements int num_students; cout << "Number of students: " << flush; cin >> num_students; student_marks.resize (num_students); for (vector<double>::size_type i = 0; i < num_students; i++) { cout << "Enter … | |
Hello all. I have a question with no code because i'm a beginner at mfc and find it very confusing. I can see that there is a message loop in mfc. From what i understand it is like an event in windows form applications. In my mfc application i want … | |
The below code is what I have.. It's a custom type I made called Points that stores co-ordinates on the screen.. The problem is in the PointsArray Struct. When I declare one like so: [CODE] PointArray P; Point A(10, 5); for (int I = 0; I < 5; I++) { … | |
Please help me its urgent... I have a MSDN Queue class, I need your suggestion can I make a message class and enqueue its objects as an element. [CODE]// new.cpp : main project file. #include "stdafx.h" #include "message.h" using namespace System; using namespace System::Collections; void PrintValues( IEnumerable^ myCollection ); void … | |
I'm an absolute c++ beginner so please be patient. [CODE]#include <iostream> using namespace std; double array_of_5[5] = {1,2,3,4,5}; double sum(double a , double b ); double a= array_of_5[2]; double b= array_of_5[2]; int main () { cout<<"The sum of two members of the array is: " <<sum<< endl; return 0; } … | |
Hi every one this is vivek.I want a projent in oops which should be different it should be totally object oriented and i am getting confused what to do for my project.Please its urgent.Please give me some idea note:- only c++ should be used for coding | |
Read 10 numbers in an array. Each number must be between 10 and 100. As each number is read, print it only if it is not a duplicate of a number already entered. | |
i saw that we should not use the combination of new operator and free for allocating and deallocating memory in c++.. Is this right? is there any reason other than saying that the combination is calloc/free and new/delete? please help me.. thanks in advance | |
Hiya: I have tried to reproduce this equation to simple reflect a ball after colliding with a paddle (or screen bounds) R = V – (2 * V[dot]N) N I don't want to take the easy rout of just negating the velocity but is my first time trying to implement … | |
Hi, I'm having a problem with taking the user input from a richtextbox in Unicode and writing it to a Unicode text file. I'm able to read a different Unicode file and write it to the new file, but when it comes to writing the contents of the richtextbox to … | |
Hello I'm new here and I've been up two night's trying to figure out how to write a program that will convert numbers to word. If anyone can help please respond to the post. here is what I sort of figured out so far. As you can tell I'm still … |
The End.