49,761 Topics

Member Avatar for
Member Avatar for myrongainz

Hello, basically I'm trying to write a program where you ask the user to input 2 positive number. Then the program will print the lower of the two numbers to the higher of the 2 numbers and then higher of the 2 numbers to the lower of the 2 numbers. …

Member Avatar for sfuo
0
2K
Member Avatar for bwill31

I'm currently getting a fatal error LNK1120: 1 resolved externals. Can somebody help me figure out what is going on? #include <iostream> #include <iomanip> #include <fstream> using namespace std; const int MAXCHAR = 101; const int CAP = 100; struct Cart { char itemName[MAXCHAR]; char itemPrice[MAXCHAR]; char itemTotal[MAXCHAR]; }; void …

Member Avatar for bwill31
0
461
Member Avatar for Limiter

Hi, I recently started learning C++ and have decided to install it onto my computer to try writing some codes. So I chose Code Block as my IDE since it is free. I know, since I use Windows 7, you will probably recommend Visual C++. But I want to stick …

Member Avatar for sergent
0
216
Member Avatar for Tom_Weston

Alright, so what I would like to see happen is two strings attached. I know I can cout << them both and they will output an attached string, but what if i want to call the attached string in another area of my code? [CODE] #include <iostream> #include <string> using …

Member Avatar for Tom_Weston
0
134
Member Avatar for AlvinLiu

[CODE]#include "assign3.h" #include <iostream> using namespace std; Calculator::Calculator(int size) { if (size > 0) { mSize = size; mPstack = mPtop; if ((*mPstack).im && (*mPstack).re) { mSize = size; mPstack = mPtop; } else { mSize = 0; (*mPstack).re = 0; (*mPstack).im = 0; } } else { mSize = …

Member Avatar for AlvinLiu
0
185
Member Avatar for Tom_Weston

I want it so that i can enter multiple things upon input. Here's my code: [CODE] #include <iostream> #include <string> using namespace std; int main() { char dot; dot = '.'; string sztext1; string sztext2; cin >> sztext1 >> dot >> sztext2; cout << "Works..." << endl; system("pause >nul"); return …

Member Avatar for Tom_Weston
0
109
Member Avatar for efigen

Hello im a student and this is homework so i just need help, thank you. My problem is with this fibonacci sequence, we need to write a recursive function that returns void. I think i pretty much understand recursion. Please help. I initialized result=1 in the main function. For i, …

Member Avatar for efigen
0
458
Member Avatar for XodoX

I'm trying to code something that's a little complex, imo. It's a C++ program that will count the number of operations of recursive functions and will compare it with O(g(n)). This count value will basically estimate time complexity function T(n). You have to find the g(n) to get O(g(n)) that …

Member Avatar for XodoX
0
156
Member Avatar for pce369

Greetings, I have a C++ program in which I am trying to print to a file, but using the following commands it isn't working. "payrecord.txt" is created, but blank. I suspect it has to do with my choice of making the displayResults function a "void", but I am not certain. …

Member Avatar for pce369
0
88
Member Avatar for coolbeanbob

Hello, I am working on a binary search tree program. In main, line 21, I am invoking the Binary_tree insert function. I get a compiler error on line 178 of the Binary_tree file. The error says "error: cannot convert 'const int*' to 'Binary_node<int>*' in assignment. They both seem like ints …

0
68
Member Avatar for nettlock

Hello my problem is : I have an interface [CODE] class IAnexable { public: virtual IAnexable* anexar( char c ) const=0 ; virtual IAnexable* anexar( SecuenciaCaracter* sc ) const=0; virtual IAnexable* anexar( SecuenciaCaracter* sc, int inicio, int fin ) const=0; }; [/CODE] from which it inherits the following abstract class …

0
73
Member Avatar for scobi

Another problem is my program draw lines not Polygon but I want to show POLYGON.HElP ME ASAP.Check my txt file attachement [CODE] #include <stdafx.h> #include <iostream> //line_poly_file.cpp #include <fstream> #include <windows.h> #include <glut.h> using namespace std; GLsizei wh = 250; GLsizei ww = 250; void DisplayLines ( void ) ; …

0
86
Member Avatar for icebirdy

I just started learning C++ let's say i have 2 classes classes A and B Class A = a1(a,b) I want an instance of class B attributes to be like this where a1 is an instance of class A: Class B = b1(x,y,a1,z) how do i go about doing this? …

Member Avatar for sfuo
0
146
Member Avatar for coolbeanbob

Hello, I am getting the following error on line 96, and also for every function implementation below line 96. What do I need to add? error: expected unqualified-id before 'void' [CODE] //Binary_tree class interface template <class Entry> class Binary_tree { public: Binary_tree(){} //constructor //Post: An empty binary tree has been …

Member Avatar for coolbeanbob
0
1K
Member Avatar for Burn August Red

Hey everyone, I'm new to this site. one of my classmates told me about it so I'm giving it a try. anyway, for my class I need to write a code for a payroll program. so far, this is what I've written... [CODE]//Assignment 4 //Page 218 //Question 7 #include <iostream> …

Member Avatar for WaltP
0
202
Member Avatar for rmreaveal

Can someone help me convert the following C++ code to python, please. I am fairly new to python. [CODE]void main() { int i,j,cnt,l,count[50]= {0}; char str[50]; clrscr(); printf("Enter the string: "); scanf("%s",str); printf("\n\tOriginal String is: %s",str); printf("\n\n\tEncoded String is: "); l = strlen(str); for(i=0; i< l; i*=1) { j = …

0
56
Member Avatar for cipherbeale

Im having a problem with error message c4430 according to MSDN the warning is created when an int is not declared. Overlooking ,y code I can't find the problem is there something I am missing? here is the code [code=cplusplus] #include<iostream> #include<string> using namespace std; class student { public: ~student(); …

Member Avatar for Narue
0
977
Member Avatar for Isaac1024

I want to use a array to get 50 random integer numbers ,randed 1to10, and use the * to display them. How to make this ?

Member Avatar for dospy
0
72
Member Avatar for stereomatching

Below is part of the source code of an allocator from the sgistl(2.91.57) [CODE] void ( *set_malloc_handler( void(*f)() ) ) () { } [/CODE] The purpose of this function is mimic the behavior of set_new_handler. But i don't know what is the meaning of this function. return type = void …

Member Avatar for stereomatching
0
139
Member Avatar for scobi

[CODE]//#include <stdafx.h> #include <iostream> //line_poly_file.cpp #include <fstream> #include <windows.h> #include <glut.h> GLsizei wh = 250; GLsizei ww = 250; void DisplayLines ( void ) ; void MyInit ( ) ; void DisplayLines ( void ) { GLint xj, yj, j; glClear ( GL_COLOR_BUFFER_BIT ) ; fstream inStream; //inStream.open("R.txt", ios ::in); …

Member Avatar for scobi
0
306
Member Avatar for ekvenkatesh

In a program, while compiling the compiler does not give an error but while executing it, i get an error.Only "Floating point exception" is printed on the output screen.Even a cout statement given at the start of the main function doesn't get executed. Can anyone help me out with this? …

Member Avatar for nightcrew
0
2K
Member Avatar for brainfo

my code is being compiled but the window auto close after it execute value. I can do this by using getch() also but i wanto to do it without getch() .please help. [CODE] #include <iostream.h> #include <stdio.h> class greatest{ private: int x,y,z; public: void getdata(); void display(); int largest(); }; …

Member Avatar for nightcrew
0
143
Member Avatar for Macilath

Howdy, I have a few questions regarding the use of ctime within a class. I followed the example on [URL="http://www.cplusplus.com/reference/clibrary/ctime/strftime/"]http://www.cplusplus.com/reference/clibrary/ctime/strftime/[/URL] When the program is like this, it works: [CODE] #include <ctime> #include <iostream> using namespace std; int main(){ time_t current_seconds; current_seconds = time(NULL); //Fills current_seconds with the number of seconds …

Member Avatar for Macilath
0
686
Member Avatar for dudekill123

I have created a program store user data in file. But i am only getting one error only but i am unable to debug it. Please help me I used turbo C++ compiler Error is on the line int employee::search_for_employee( int choice, name_temp[20] , email_temp[50]) Here is my code [code] …

Member Avatar for nightcrew
0
149
Member Avatar for Labdabeta

I am trying to make a static library using Code::Blocks and when I make a new static library project it generates a cpp file with functions encased with [ICODE]extern "C"[/ICODE] I am just wondering if this is necessary or if I can write the functions in normal c++ as well.

Member Avatar for vijayan121
0
130
Member Avatar for QQnoobie

Trying to define a function that dynamically creates a Student object and then prompts the user for the info and returns pointer to a Student object. [CODE]class Student{ private: string firstName; string lastName; string aNumber; double GPA; public: Student (); Student (string f, string l, string idNo, double gPoint); string …

Member Avatar for QQnoobie
1
139
Member Avatar for Sumeet6

You are to write a program to test the <ctime> library from the C++ Standard library. In particular, we are interested in testing the function clock () that counts the ticks since the program was started. It is known that this function returns different results for different C++ implementations/architectures. In …

-3
66
Member Avatar for pce369

Hi, I am trying to undertake an exercise in which a payroll file is generated. Unfortunately, I seem to be having problems with respect to passing values to functions that calculate pay for various types of employees and tax rates. The code compiles and runs, but generates zeroes for the …

Member Avatar for pce369
-1
261
Member Avatar for phorce

Hello, I am working on an algorithm that checks to see if a value is in an array, however, it doesn't seem to want to work .. It will display that the first number is there but nothing else.. Any ideas? Heres the code: [code] #include <iostream> using namespace std; …

Member Avatar for gerard4143
0
307
Member Avatar for greimykudau

[CODE]#ifndef NODE_BINARIO_H #define NODE_BINARIO_H # include "Colacircular.h" # include <iostream> using namespace std; template<class T> struct Node_Binario // struct of node { T Dato; Node_Binario<T> *left; Node_Binario<T> *right; int Profundida; }; template<class T> // class tree class Arbol { public: Arbol(); //constructor bool Insert(Node_Binario<T> * raiz,T item); // funtion insert …

0
39

The End.