48,986 Topics

Member Avatar for
Member Avatar for ksm092

Hi, I have two classes in two separate .cpp files. I obtain a string using cin and then I need to use this string in a method in a separate class. If that makes sense.. [CODE]class HomePage{ static void HsubmitChangeDutyRequests(string) { Duties::submitChangeDutyRequests(string);} }[/CODE] [CODE]class Duties{ static void submitChangeDutyRequests(string); }[/CODE] This …

Member Avatar for vijayan121
0
322
Member Avatar for WolfShield

C++ was once the King of programming. It would crush any competitor! But, now it seems that C++ is getting less popular. New programmers are rushing to easier to learn, higher level, programming languages (e.g. Java). And with Microsoft coming out with C# which is gaining popularity (even though it …

Member Avatar for Netcode
0
1K
Member Avatar for maybnxtseasn

Because references always “point” to valid objects, and can never be pointed to deallocated memory, references are safer to use than pointers. Can anyone give an example of this? this doesnt make sense. couldn't you just do [CODE]int& function() { int variable = 3; return variable&; }[/CODE] looks deallocated to …

Member Avatar for vijayan121
0
101
Member Avatar for Seiko09

Hi, im new here, and i want to ask about "how to make a compiler". I'm a Computer Science and part of my subject wants me to create a compiler, and I had no idea of how to create one. Can anyone help me.....

Member Avatar for vijayan121
1
236
Member Avatar for sergent

It seems like when invoking a function explicitly, it should be compiled at compile-time with a specific variable type, but I am not sure how implicit function invokation works. I don`t think compiler will create a different function for evey datatype available (since there can be many different data-types in …

Member Avatar for stereomatching
0
176
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 sundip
0
415
Member Avatar for kazewafuiteiru

I have to do a 4 function calculator for class with the do...while loop. With the option of ending the program after the while by either entering 'y' or 'n'. However the program automatically loops without seeking input to restart or not. [CODE]/* This is a four function calculator with …

Member Avatar for WaltP
0
163
Member Avatar for Raim

So I'm making a simple calculator program on the Windows Form Application of C++. Nevertheless, I'm stuck on the exponents, factorial, and square root part. In my System32 Console calculator, these were the codes I use for the exponent, factorial, and respectively, while I just used the sqrt function of …

Member Avatar for Raim
0
397
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
452
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
215
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
181
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
108
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
455
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
155
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
190
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
965
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
135
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

The End.