Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
M

Mikerush7

@Mikerush7
About
Posts
5
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Finding Min and Max of array
    M Mikerush7

    Thank you for your help !

    C / C++ / MFC data-structures help question

  • Finding Min and Max of array
    M Mikerush7

    Hi. I have assignment to find difference between Min and Max of an array of 5 numbers. I did some work, but after compiling - my program does not run, it just stops working.. Can you help me, where is my mistake ? Array values needs to be double.

    #include #include int main()
    {
    int i; // element in array
    int size; // size of array
    double array [i]; // number of elements in array
    double min; //minimum value
    double max; // maximum value
    double difference; // difference between maximum and minimum values

    printf("Enter the size of the array: ");
    scanf("%d",&size);
    printf("Enter %d elements in to the array: ", size);
    scanf("%d",&array[i]);

    max = array[0]; // let first number in array be maximum
    for (i=0; iarray[i])
    min = array [i];
    {
    printf("Minimum value is: %d\n",min);
    }

    difference = max - min;

    printf ("Difference between Min and Max values is %d\n", difference);

    /* if (i>= 5)
    {
    printf ("Only 5 numbers allowed. \n");
    break;
    }
    */

    system("PAUSE");
    return 0;
    }

    C / C++ / MFC data-structures help question

  • need code to check if the value is numeric in C
    M Mikerush7

    thank you everybody for help. I will keep working on it. my teacher is not helping, so I am on my own..

    C / C++ / MFC help tutorial question career

  • need code to check if the value is numeric in C
    M Mikerush7

    i dont really know how to do that yet... Ok, i will try.. is there a general format of that function somewhere?

    C / C++ / MFC help tutorial question career

  • need code to check if the value is numeric in C
    M Mikerush7

    I am student, taking C programming now. I have assignment to write function to check if inputed data is numbers. if not - it should write that, and ask to enter number again. I wrote code, to write error message, but dont know how to make program to work on next input.. should I call the Main function again ? int main() { double hours; //hours worked in a week double payrate; // hourly salary double grosspay; //total weekly payment int k; //number of values read printf ("Enter number of hours, and hourly pay (or press 0 to exit) \n"); while ((k = scanf ("%lf%lf", &hours, &payrate))==2) { if (isdigit(hours) !=0) return hours; else printf ("You entered invalid data, please enter number of hours \n"); if (isdigit(payrate) !=0) return payrate; else printf ("You entered invalid data, please enter payrate \n"); if (hours==0 || payrate==0) { printf ("Good Bye. \n\n"); system("PAUSE"); return 0; } double grosspay; grosspay = calculateGrossPay(hours, payrate); printf ("Hours worked: %.2f\n", hours); printf ("Hourly Rate: %.2f\n\n", payrate); printf ("Your weekly payment is: $ %.2f \n\n\n", grosspay);

    C / C++ / MFC help tutorial question career
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups