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
D

dr eu

@dr eu
About
Posts
16
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Read file, write to array, find min and max
    D dr eu

    O.K., Thank you anyway for yours great help and good understanding. I'll try to do it well alone, but i'm not sure in access. Thanks again and goodbay !

    C / C++ / MFC data-structures help

  • Read file, write to array, find min and max
    D dr eu

    I try, but compiler return erors: too few arguments to function `float * biggest(float *, int)' at this point in file too few arguments to function `float * smallest(float *, int)' at this point in file

    C / C++ / MFC data-structures help

  • Read file, write to array, find min and max
    D dr eu

    I done so: while (fscanf(in,"%f",&element) != EOF) { table[num_elements] = element; current_number=element; current_number%100==0; num_elements++; } but steel dont work propertly.

    C / C++ / MFC data-structures help

  • Read file, write to array, find min and max
    D dr eu

    In that case, i have to import another counter j: int j; bigj=biggest(&table[j], 100); Is right so?

    C / C++ / MFC data-structures help

  • Read file, write to array, find min and max
    D dr eu

    Yes, from that almost i am gona crazy. The result is O.K. (for all numbers in file). Help me please with 100, 200, ... elements in array !!!

    C / C++ / MFC data-structures help

  • Read file, write to array, find min and max
    D dr eu

    About homework you have right ! About teacher ... Who nows ? Any way could you help ?

    C / C++ / MFC data-structures help

  • Read file, write to array, find min and max
    D dr eu

    Yes, but how can i write big10489=biggest(&table[1048800], 100); ? This will take a lot of my time. And i don?t now, if file is so long?

    C / C++ / MFC data-structures help

  • Read file, write to array, find min and max
    D dr eu

    I want to read all numbers and get the largest and smallest, but only from first 100 numbers in array[100], after that the same with another 100 numbers and so on.

    C / C++ / MFC data-structures help

  • Read file, write to array, find min and max
    D dr eu

    How must i do that?

    C / C++ / MFC data-structures help

  • Read file, write to array, find min and max
    D dr eu

    //This program read file *.txt, than 100 float numbers(or int numbers, if they are present) //write in a float array.Next, finds MIN and MAX element in float array with using pointers, //write results on the screan and if there is no more numbers, go to end, else repet all again. #include #include #include #define MAXELEMENTS 100 // MAX numbers of elements //funkcion for max element in float array float *biggest(float table[],int number) { int counter, counter_max; float aretheysame=0; for(counter=0; counter < number; counter++) { if (*(table+counter) > aretheysame) { aretheysame = *(table+counter); counter_max = counter; } } return(&*(table+counter_max)); } //finkcion for min element in float array float *smallest(float table[],int number) { int counter, counter_max=0; float aretheysame=table[0]; for(counter=0; counter < number; counter++) { if (*(table+counter) < aretheysame) { aretheysame = *(table+counter); counter_max = counter; } } return(&*(table+counter_max)); } main(void) { FILE *in; char inter[255]; int num_elements=0; float element; static float table[MAXELEMENTS]; float *small,*big; printf("Adress and value of max and min element in array\n"); printf("Enter file name : "); gets(inter); in= fopen(inter,"r"); if(in == NULL) { printf("Error. No file with this name\n"); exit(1); } while (fscanf(in,"%f",&element) != EOF) { table[num_elements] = element; num_elements++; } if (num_elements > 1) { big=biggest(table,num_elements); printf("\nThe adress of max element is %d",&*big); printf(", with value %f",*big); small=smallest(table,num_elements); printf("\nThe adress of min element is %d",&*small); printf(", with value %f",*small); } else { ; } fclose (in); getchar(); } And *.txt file: 0 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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2000 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

    C / C++ / MFC data-structures help

  • Console to win app
    D dr eu

    This is example, I used once for static window, but is not good for my program above. Boco #include LRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { switch(message) { case WM_DESTROY: { PostQuitMessage(0); break; } case WM_PAINT: { HDC hdc; hdc=GetDC(hwnd); TextOut(hdc, 163, 60, "HELLO !", strlen("HELLO !")); TextOut(hdc, 90, 120, "TODAY IS REALY NICE DAY.", strlen("TODAY IS REALY NICE DAY.")); TextOut(hdc, 52, 140, "RIGHT ONE FOR SITTING BEFORE PC.", strlen("RIGHT ONE FOR SITTING BEFORE PC.")); TextOut(hdc, 125, 220, "***** THE END *****", strlen("***** THE END *****")); ReleaseDC(hwnd, hdc); break; } return 0; } return (DefWindowProc(hwnd, message, wparam, lparam)); } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow) { WNDCLASSEX winclass; const char AppName[] = "myClass"; winclass.cbSize = sizeof(WNDCLASSEX); winclass.style = CS_HREDRAW; winclass.lpfnWndProc = WindowProc; winclass.cbClsExtra = 0; winclass.cbWndExtra = 0; winclass.hInstance = hInstance; winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); winclass.hCursor = LoadCursor(NULL, IDC_ARROW); winclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); winclass.lpszMenuName = NULL; winclass.lpszClassName = AppName; winclass.hIconSm = LoadIcon (NULL, IDI_APPLICATION); if (!(RegisterClassEx(&winclass))) {return 0;} CreateWindowEx (NULL, AppName, " WINDOW FOR TEXT", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 300, 200, 400, 300, NULL, NULL, hInstance, NULL); MSG message; while (GetMessage(&message, NULL, 0, 0)) { TranslateMessage(&message); DispatchMessage(&message); } MessageBox (NULL, "DO YOU WANT TO EXIT THIS PROGRAM ?" , " EXIT", 0 + MB_YESNO + MB_ICONQUESTION); return 0; }

    IT & Infrastructure c++ help tutorial announcement learning

  • Console to win app
    D dr eu

    I had done that, but I can made only static window with text and MessageBox with buttons Yes and No. Boco

    IT & Infrastructure c++ help tutorial announcement learning

  • Console to win app
    D dr eu

    Mike, that sounds very havy, do you have maybe same example like my program is ? Boco :confused:

    C / C++ / MFC c++ help tutorial announcement learning

  • Console to win app
    D dr eu

    Hello ! I am beginner in C++ and i need some help from you ! I want to make my console program into windows application, but I dont now how to do it. Please help me ! Thank you. Boco :confused: //PROGRAM FOR CALCULATING SUM AND AVERAGE OF TWO NUMBERS #include #include int main () { float num_1, num_2; double sum, average; cout << "\n\t\t******************************************* "; cout << "\n\t\t* PROGRAM FOR CALCULATING SUM AND AVERAGE * "; cout << "\n\t\t* OF TWO NUMBERS * "; cout << "\n\t\t* Version 1.0, February, 2004 * "; cout << "\n\t\t******************************************* "; cout << "\n\n\n\n\n Enter first number: "; cin >> num_1; cout << "\n Enter second number: "; cin >> num_2; sum = num_1 + num_2; average = sum / 2.0; cout << "\n\n Calculated sum is: " << sum << endl; cout << "\n Calculated average is: " << average << endl; cout << "\n\n\n\n\n For exit from program press [Enter] >>>>> "; getchar(); return (0); }

    C / C++ / MFC c++ help tutorial announcement learning

  • Console to win app
    D dr eu

    Yes, I now, but how must do it ? :confused: Boco

    IT & Infrastructure c++ help tutorial announcement learning

  • Console to win app
    D dr eu

    Hello ! I am beginner in C++ and i need some help from you ! I want to make my console program into windows application, but I dont now how to do it. Please help me ! Thank you. Boco //PROGRAM FOR CALCULATING SUM AND AVERAGE OF TWO NUMBERS #include #include int main () { float num_1, num_2; double sum, average; cout << "\n\t\t******************************************* "; cout << "\n\t\t* PROGRAM FOR CALCULATING SUM AND AVERAGE * "; cout << "\n\t\t* OF TWO NUMBERS * "; cout << "\n\t\t* Version 1.0, February, 2004 * "; cout << "\n\t\t******************************************* "; cout << "\n\n\n\n\n Enter first number: "; cin >> num_1; cout << "\n Enter second number: "; cin >> num_2; sum = num_1 + num_2; average = sum / 2.0; cout << "\n\n Calculated sum is: " << sum << endl; cout << "\n Calculated average is: " << average << endl; cout << "\n\n\n\n\n For exit from program press [Enter] >>>>> "; getchar(); return (0); }

    IT & Infrastructure c++ help tutorial announcement learning
  • Login

  • Don't have an account? Register

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