Your use of
{
and
}
makes no sense. Just what is going on from line 20 - 22?
#include<stdio.h>
Join us in C++ ; use cstdio instead.
Except don't. Use iostream instead, unless you really do have a good reason for writing C code.
#include<conio.h>
This is non-standard and suggests you're using an old, non-standard compiler and probably an old, non-standard IDE. That's not going to help you learn C++. Get a new one, for free.
void main ()
This is just plain wrong. In C++,
main
returns an
int
, always always. Are you writing C++?
printf("%a is the highest the lowest is b",%a);
In the string you're passing to
printf
, you are marking the value to be substituted as %a. Let's look at the printf documentation;
http://www.cplusplus.com/reference/cstdio/printf/
We can see there that
%a
means "Hexadecimal floating point, lowercase". I don't think you mean that. I think you mean to provide a simple number. So you should be using
%d
, not
%a
The second parameter you're passing to printf is %a. That just makes no sense at all. I think this is what you meant:
printf("%d is the highest the lowest is b",a);
If you were to write this in C++, it would look something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#include <iostream>
int main()
{
int a;
int b;
std::cout << "Determine which one is highest or lowest between two integers \n Enter a two numbers:";
std::cin >> a >> b;
if(a>b)
{
std::cout << a << " is the highest the lowest is " << b;
}
else
{
std::cout << b << " is the highest the lowest is " << a;
}
}
|