107 Topics

Member Avatar for
Member Avatar for rizwan.ali.1656

HI I would like to modify the following function so that it could take any of the operators such as +,-,* or /. I want to know if its possible to do this without having to write bunch of ifs and else to define each of the operators separatly like …

Member Avatar for ravenous
0
350
Member Avatar for daniel.krishnasamy

Please Help me with this Date Operation Program. I think that this works....yet! Thanks #include <iostream.h> #include <conio.h> int a[7]={1,3,5,7,8,10,12}; int b[7]={4,6,9,11}; class manipdate { int date; int month; int year; public: int d,m,y; void getdata() { cout<<"\n\n Date : "; cin>>date; cout<<"\n Month : "; cin>>month; cout<<"\n Year : …

Member Avatar for Ancient Dragon
0
540
Member Avatar for rahul.ch

I noticed that when equals() is used to compare between two String objects it works fine. But when I compare two StringBuffer objects or two StringBuilder objects or mix of String and Builder and Buffer, equals() doesn't work even though I give same string value to the two objects being …

Member Avatar for rahul.ch
0
318
Member Avatar for loshan.moonsamy

Problem: The statement ++Chequebook1; should increment the member variable Balance of Chequebook1 by R100. Give three different implementations for the overloaded operator ++ to accomplish this: • using the member function Adjust() • implementing the overloaded operator ++ as a friend function • implementing the overloaded operator ++ as a …

Member Avatar for np complete
0
171
Member Avatar for lloydy76

Hi there, im new to c# and have been trying to create a calculator without a switch statement, using the operator 'op' as a variable, but i cannot get it to work, here is my current code: [code] using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; …

Member Avatar for samsylvestertty
0
5K
Member Avatar for 111100/11000

#include <iostream> #include <cmath> #include <string> #include <cstdlib> #include <cstring> using namespace std; char Outputing(char shifted_letter); int found_match; int searching_alphabet; int main() { const char ORIGINAL_alphabet[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; //maybe const isn't necesery char alphabet[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; cout << "This program encrypts messages using Ceaser Cipher\n"; cout << "\n---------------------------------------------------------"; cout << "\n---------------------------------------------------------"; cout << "\nEnter …

Member Avatar for Labdabeta
0
326
Member Avatar for vijayabhaskar.chowdary

1) Write a program to make commandline calculator ? Format like that : excutablefile firstoperand opertator secondoperand Ex : ./a.out 1 + 3 result : 5

Member Avatar for WaltP
-1
87
Member Avatar for eggsandbacon

Hey everyone, I'm working on an assignment and I'm having some trouble figuring out how to implement two operators. The program creates and implements a class to represent the Stack ADT using a singly-linked list. There is a driver program to test my implementation. I have everything implemented (except the …

Member Avatar for aranayd
1
1K
Member Avatar for calvinmicklefin

I have the following code ... <?php // test $item_101_product_title = "MGT-101"; $item_102_product_title = "MGT-102"; $item_103_product_title = "MGT-103"; $item_104_product_title = "MGT-104"; $item_105_product_title = "MGT-105"; $item_106_product_title = "MGT-106"; $item_107_product_title = "MGT-107"; $item_108_product_title = "MGT-108"; $item_109_product_title = "MGT-109"; $item_110_product_title = "MGT-110"; $item_111_product_title = "MGT-111"; $item_112_product_title = "MGT-112"; $item_113_product_title = "MGT-113"; $message = …

Member Avatar for calvinmicklefin
0
182
Member Avatar for wildplace

let say i have an expression like the one below, I guess it goes from left to right? if(exp1 && (exp2 && exp3 || exp4) || exp5)

Member Avatar for wildplace
0
111
Member Avatar for warzaru

Hello, after I have friendet my class to "<" operator it dosn't work after i use sort over an vector of class instances it does nothing: class + main : class RAngle{ public: int x,y,l; RAngle(){ } RAngle(int i,int j,int k){ x=i,y=j,l=k; } bool operator<(const RAngle& rhs)const { if(l < …

Member Avatar for Lucaci Andrew
0
322
Member Avatar for phfilly

Hi -i've started using netbeans and compiling in it recently and I'm not sure what the problem is here. Not sure if it isn't reading the Element.cpp/.h files while building/running the main.cpp In my main: Element a, b(5); cout<<(5+b)<< endl; Then in the .h: Element operator+(const Element&obj); And in the …

Member Avatar for rubberman
0
163
Member Avatar for |-|x

Does anyone know a good way to force javascript to evaluate all operands in a boolean expression? In particular, what I am tring to do is essentially this: return isValid(a) && isValid(b) && isValid(c); while this technically does work, the function is responsible for highlighting invalid areas on the form …

Member Avatar for |-|x
0
427
Member Avatar for Octet

I am attempting to create a script which checks to see if the user has a warning level of less than 3. Basicaly, I want to automatically deny any account which has a Warning Level (stored in the Database) of 3 or more from logging in but whenever I attempt …

Member Avatar for Octet
0
164
Member Avatar for greatman05

Hello. I need to create a program to manipulate polynomials. It contains basic evaluation, addition, subtraction and multiplication of polynomials. Right now, I'm working on overloading the '+' operator to add two polynomials. While the function adds the two polynomials together correctly, when it goes to output through the overloaded …

Member Avatar for greatman05
0
2K
Member Avatar for FelineHazard

Hi all, I am doing some c++ exercise about operator replacing. I have successfully replaced the + (plus) operator to work on a user-defined class. I understand these operators are order-sensitive: need to replace the operator for (class+int) and for (int+class). Thus, creating **two** replacements that do exactly the same. …

0
147
Member Avatar for FelineHazard

Hi guys, I'm learning C++ from a book and I have a question about defining unary operators: In the book I'm working with there's an example, where they define a class called point, and define ++ operator for point *as friend*. here's the example: ~~~ c class point { int …

Member Avatar for FelineHazard
0
212
Member Avatar for jerryjerry

Hi all, I have implemented overloaded function for operator new. In this function I have not allocated any memory still while exiting from program it is getting crashed. Code is as below: class A { public: int a; int b; A() { cout<<"Inside A::A()"<<endl; } void* operator new(size_t s) { …

Member Avatar for L7Sqr
0
237
Member Avatar for kutchbhi

This is the project I am reading from . [url]https://github.com/sasatomislav/PHP5-OOP-Cart[/url] [CODE] class Cart { <snip> private function __construct() {} /** * Fetch Cart instance * * @return Cart */ public function getInstance() { if (NULL === self::$_instance) { self::$_instance = new self; } return self::$_instance; } } <snip> // initialize …

Member Avatar for pritaeas
0
262
Member Avatar for jnewman3

So I have a matrix class that must run on a unix/linux server. The main is a test file that is provided by the instructor. When I compile my code in visual studio it works fine except for test 8 because I can't figure out how to return a print …

Member Avatar for jnewman3
0
1K
Member Avatar for aparichit4evr

Hello friends...I'm having confusion about binary operator overloading in the following program. The question goes like this. Qn. Create a class time with two member variables as hours and minutes of integer type,write default,parameterized and copy constructor. Overload necessary operators to compute T3=5+T1+T2, where T1,T2 and T3 are time objects. …

Member Avatar for tungnk1993
0
276
Member Avatar for pushpat

Hi folks, I am learning operator overloading concept in c++, wrote sample program to test overloading of unary operator '!' and '-'. Code will work if i use them as friend function but not for member function. Can anybody tell where am i going wrong in function bool operator!(const co_ordi …

Member Avatar for pushpat
0
325
Member Avatar for Labdabeta

I was working on a project when I thought that maybe a ::. operator would look funny in some code. Just for fun I typed that into the global scope area like this: [CODE]::. int main() { //etc...[/CODE] and my code completion software said too many results to display. My …

Member Avatar for Labdabeta
0
190
Member Avatar for pwolf

Stuck again, still, im learning from my large list of mistakes, haha so this time im trying to convert a decimal to hexadecimal, i tried using hex(number) but its not suitable for the situation as this returns a string. and i dont know how or if i can convert a …

Member Avatar for pwolf
0
2K
Member Avatar for Labdabeta

I am really confused as to the purpose of the unary + operator. What in the world does it do? I have tested it and it doesn't return the absolute value. Does it just return the operand? And if so what purpose is it?! (I mainly care about integer types)

Member Avatar for mrnutty
0
296
Member Avatar for Dman01

Hi The following code shows good enough how to multiply two long data [CODE]long x = 10, y = 3; long p = 0; while (y > 0) { if ((y & 01) != 0) p += x; x <<= 1; y >>= 1; } std::cout << "\nResult : " …

Member Avatar for Dman01
0
667
Member Avatar for techlawsam

prompt: need the user to input 1st and last values for the table. DIsplay in a column in the table starting with 1st base value that was inputted. Last column has to the ending base value that was entered. I need to make 15 rows of computations. First row should …

Member Avatar for ddanbe
0
215
Member Avatar for corby

im trying to overload the operator+= and use that to implement operator+ in my string class. i keep getting a segmentation fault when i try to evaluate something like s1 += s2 where MyString s1("");and MyString s2("hello"); any suggestions as to why this is happening? this is my operator+= function …

Member Avatar for corby
0
179
Member Avatar for techlawsam

total += nValue; so would that mean that whatever the total is it will be added towards nValue, or is something being incremented? Thanks

Member Avatar for jnmisa
0
108
Member Avatar for Ccuteri60

Hi, i am making a heap sort program using a struct known as Date, anyhow i am getting an error in two lines that i cant figure out how to solve...[CODE]void dahHeap(Date a[], int i){ int n = sizeof(a); int lefty = 2 * i; int righty = 2 * …

Member Avatar for Ccuteri60
0
372

The End.