delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/11/07/15:48:16

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <008f01c048fb$f3198120$e6fefea9@sto.zaz.com.br>
From: "Keyser Soze" <keysers AT terra DOT com DOT br>
To: <cygwin AT sourceware DOT cygnus DOT com>
Subject: Newbie half off topic: '*' substituted by 'c'
Date: Tue, 7 Nov 2000 18:47:29 -0200
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400

------=_NextPart_000_008B_01C048EB.2E735A40
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_008C_01C048EB.2E735A40"


------=_NextPart_001_008C_01C048EB.2E735A40
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I made a simple code to examplify, a calculation program, but when you =
do: "conta 2 * 4" it doesn't do the multiplication, after making a =
printf call to see what argc[2] contains, it appears 'c'.
Anyone knows what is happening?

Keyser Soze

------=_NextPart_001_008C_01C048EB.2E735A40
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>I made a simple code to examplify, a calculation =
program, but=20
when you do: "conta 2 * 4" it doesn't do the multiplication, after =
making a=20
printf call to see what argc[2] contains, it appears 'c'.</FONT></DIV>
<DIV><FONT size=3D2>Anyone knows what is happening?</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Keyser Soze</FONT></DIV></BODY></HTML>

------=_NextPart_001_008C_01C048EB.2E735A40--

------=_NextPart_000_008B_01C048EB.2E735A40
Content-Type: application/octet-stream;
	name="conta.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="conta.c"

#include <stdio.h>

main(int argv, char *argc[]){

int num1, num2;
char oper;

if(argv < 4)	{
	printf("\nWRONG!!!\n%s num1 oper num2", argc[0]);
	return(-1);
		}

num1 = atoi(argc[1]);
num2 = atoi(argc[3]);
oper = *argc[2];

switch(oper){
	case '+': printf("\n %d\n", num1 + num2); break;
	case '-': printf("\n %d\n", num1 - num2); break;
	case '*': printf("\n %d\n", num1 * num2); break;
	case '/': printf("\n %d\n", num1 / num2); break;
	default: printf("\n %c nao e operador",oper); break;
		}
return 0;
}

------=_NextPart_000_008B_01C048EB.2E735A40
Content-Type: text/plain; charset=us-ascii

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
------=_NextPart_000_008B_01C048EB.2E735A40--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019