49,757 Topics

Member Avatar for
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
200
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
973
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
138
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
305
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
141
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
685
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
138
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
276
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
Member Avatar for HungMob

Hello, I'm a Freshman in college that's going to majoring in Electrical and Computer Engineering. Right now I'm taking a C++ class and I'm looking to do something funny to a friend of mine. I have been searching the web for some "fake viruses" and whatnot to to play around …

Member Avatar for NetJunkie
0
5K
Member Avatar for scobi

[CODE] #include <windows.h> #include <gl/gl.h> #include <gl/glu.h> #include <glut.h> #include <stdio.h> void drawCube(); float vertices [8][3]; int facets [6][4]; void read_file (char **argv); void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_FLAT); } void display(void) { glClear(GL_COLOR_BUFFER_BIT); drawCube(); glEnd(); glFlush(); glutSwapBuffers(); } void reshape (int w, int h) { …

Member Avatar for scobi
0
164
Member Avatar for blt007

Ive been having trouble solving this please help, yea its hw but im using this as a last resort as its due in 2 hours. [CODE] // Search a dictionary file for the word input by the user. // //////////////////////////////////////… #include<iostream> #include<string> #include<fstream> using namespace std; int main() { string …

Member Avatar for blt007
0
624
Member Avatar for Ich bin würdig

Can someone tell me what's wrong with my syntax.. THanks [CODE] #include<stdio.h> #include<conio.h> void FACTORIAL(int factorial=1, int N) {int y; {for(y==1;y<=N;y++) factorial=factorial*y; printf("The factorial of %d is %d", N,factorial);} } void main() {clrscr(); printf("Please enter a no."); scanf("%d",&N); FACTORIAL(factorial=1,N); getch(); } [/CODE]

Member Avatar for Narue
0
104
Member Avatar for Tom_Weston

[CODE]#include <iostream> #include <windows.h> #include <string> using namespace std; void main() { string run; cin >> run; ShellExecute(NULL, NULL, run /*<<<the error*/, NULL, NULL, SW_SHOWNORMAL); }[/CODE] I want it so if i enter a file path, it open. If i replace run with "E:/test.exe", it works... but i want it …

Member Avatar for Tom_Weston
0
174

The End.