Help!!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<stdio.h>

void main()
{
    int first, second, third;
    clrscr();

    printf("Input first integer:");
    scanf("%d",&first);
    printf("Input second integer:");
    scanf("%d",&second);
    printf("Input third integer:");
    scanf("%d",&third);

    if(first>second)

    if(second>third)

    if(first>third)

    printf("Correct Order:");
    printf("%d,%d and %d");

    getch();
}


Please help me... this is not working... I want to create a program which creates an ascending order by input of 3 integers..... HELP!!
1
2
3
4
5
    if(first>second)

    if(second>third)

    if(first>third)


you really need to work through some of the tutorials on this site. You aren't doing anything with these if's. In addition I see no sorting logic at all.

On top of that, you are writing this in C and not C++.
Please help me... this is not working... I want to create a program which creates an ascending order by input of 3 integers..... HELP!!


The worst way to ask a question.

at least you used code tags

What is not working?

If you compile errors, then post them here, verbatim.

Never mind, I have already done it for you:



3:11: error: '::main' must return 'int' In function 'int main()': 
6:12: error: 'clrscr' was not declared in this scope 
22:26: warning: format '%d' expects a matching 'int' argument [-Wformat=] 
22:26: warning: format '%d' expects a matching 'int' argument [-Wformat=] 
22:26: warning: format '%d' expects a matching 'int' argument [-Wformat=] 
24:11: error: 'getch' was not declared in this scope


When you use scanf, make use of it's return value to see that it worked, otherwise you are asking for trouble.
Thanks all of you... But can u post me a source code written in c++ of above problem please.....
But can u post me a source code written in c++ of above problem please.....


Nope. That is your job, we don't do homework here.

If you read through the tutorials, and have a go - then if you still have problems, then ask a question. Post the code that you tried.

For example, read up about if statements, and get that working.

Read the documentation for each function you are using.
ok.... TheIdeasMan.......
Topic archived. No new replies allowed.