Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 09-27-2004, 10:33 AM   #1
Member (1 bit)
 
Join Date: Sep 2004
Posts: 1
Finding Sum without using + operator

Hi,
I want to do the following:

int a = 10;
int b = 2;
int res = 0;
char *op = "+";

// now, without using + operator in the next coming lines,can i get the sum
// of a and b like in following way:

res = a op b;

or in any other manner using 'op' instead of '+'.
Can we do this?
Tapan Sharma is offline   Reply With Quote
Old 09-27-2004, 10:56 AM   #2
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
No, the compiler isn't going to like that.

Is this some kind of assignment where you have to find a sum without using +?
doctorgonzo is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:53 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2