Ok guys i got a problem and i dont know where to start to fix it...
its when you try to input somthing and then try to display it...it just blows up...i know its somthing dumb cause i tried (very badly i might add) to put two programs together very quickly...so if you guys can figure out whats wrong let me know.. ThanksCode:#include<stdio.h> #include<conio.h> #include<stdlib.h> void display(); int getinput(); int Subgetinput(char* p, int size); bool Subgetinput2(char* p); char input; // YEAH SO ITS GLOBAL....SO WHAT int main() { //char aWord[5]; while(true) { system("cls"); printf("\n\t\tMain Menu\n"); printf("F1 = Get Input\nF2 = Display input\nF3 = Exit\n"); char choice; choice = getch(); if(choice == 0) { choice = getch(); if(choice == 61) break; switch(choice) { case 59: getinput(); break; case 60: display(); break; default: printf("try again."); break; } } else printf("Not a valid choice."); } } int getinput() { char arr1[15]; printf("enter Some characters: "); int over; over = Subgetinput(arr1, sizeof(arr1)); //input = ; system("pause"); } int Subgetinput(char* p, int size) { char* end; end = p + size - 1; char in; int overflow; overflow = 0; while(true) { in = fgetchar(); input = in; if(in == 10) break; if(p < end) { *p = in; p++; } else overflow++; } *p = 0; return overflow; } bool Subgetinput2(char* p) { char* beginning = p; if(*p == 0) return false; while(*p != 0) { if(*p ==' ')return false; p++; } p = beginning; while(*p != 0) { if(*p==*(p + 1)) { if(*p == *(p + 2)) return false; } p++; } return true; } void display() { printf("\t%s",input); system("pause"); }



LinkBack URL
About LinkBacks



)