Re: Problems with a program

From: Johnny Lange (JohnnyLange_at_discussions.microsoft.com)
Date: 09/01/04


Date: Tue, 31 Aug 2004 19:51:04 -0700

Thanks for the help! I took back that book, because it didn't really explain
pointers and strings very well. Perhaps it's more for someone who experienced
with programing. So I picked up... How to program C++, fourth edition, by
Deitel. It's just native C++, (not MC++) I figured it might be better just to
learn "unmanged" C++ code first, then switch to MC++. I took one of the
figure examples in the book, edited it to make the program I was orignally
trying to make in MC++. The book explains everything much better, I actually
understand the stuff...lol

The following is working source code:
// Fig. 1.6:
// This program was edited to include some extras from the book
// "How to program C++ ,4th Edition" by Deitel

#include <iostream>

int main()
{
                int integer1;
                int integer2;
                int sum;
                int difference;
                int product;
                int quotient;
                int modulation;

                std::cout << "Enter first integer\n";
                std::cin >> integer1;

                std::cout << "Enter second integer\n";
                std::cin >> integer2;

                sum = integer1 + integer2;
                difference = integer1 - integer2;
                product = integer1 * integer2;
                quotient = integer1 / integer2;
                modulation = integer1 % integer2;

                std::cout << "Sum is\n " << sum << std::endl;
                std::cout << "difference is\n " << difference << std::endl;
                std::cout << "product is\n " << product << std::endl;
                std::cout << "quotient is\n " << quotient << std::endl;
                std::cout << "modulation is\n " << modulation << std::endl;
                return 0;
}



Relevant Pages

  • Re: A taxonomy of types
    ... however, elsewhere in my project (off in the dynamic typesystem, ...), I ... (since I am using NULL-terminated strings), and so I have used U+10FFFF ... remember, C also has things like arrays, funtion pointers, nestable ... int RIL_TypeSmallIntP; ...
    (comp.lang.misc)
  • RE: passing string array to C++
    ... Does this apply to all marshalling of passing arrays of pointers? ... other challenges in this area such as passing an array of pointers to class ... > private static extern int MyAdapt(int gbl, stringstrings, int count ...
    (microsoft.public.dotnet.framework.interop)
  • Re: String Comparision
    ... code which would compare two strings using pointers. ... int comp ...
    (comp.lang.c)
  • Re: array of pointers
    ... All the three pointers point to literal strings, ... in memory that doesn't belong to you and that could be in read- ... If you want to change the memory the pointers are pointing ... > int size = strlen; ...
    (comp.lang.c)
  • Re: meaning of a dialet or implementation of a programming language
    ... It has to do with strings ... >> being pointers. ... >> $ cat test.c ... >> int main{ ...
    (comp.lang.lisp)