No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
28 Posted Topics
Hello! I'm new to c++ but I have a problem and desparate for help. I'm trying to store string and integers into a file, but only strings get stored and integers dont. I tried casting,didnt work. Not to convolute you with my code, I came up with this small program … | |
Hello, I have a a problem copying individual words inside 2D array. Array is dynamically created and initializes perfectly, but as soon as i call my function, and if i have 2 or more spaces between the words, its copying the spaces inside the next index element of the array. … | |
Hello., I'm reading about anonymus structs and have problems understanding what is the privilege to have one. could anyone demonstrate an example of both anonymus and regular struct. I see that anonymus struct has a name after the the } and before semicolon. Any help would be greatly appreciated. Thank … | |
Hello., Have a question about array being set from function argument. I wrote this little program, and want to know why cant i set an array size from the function argument. Any help would be greatly appreciated. [CODE] int money(int deposit, ...){ int i, sum = 0, nextvar; // myArr[deposit]; … | |
Hello., I'm very green in c++, and at school we just had a first lesson on pointers to functions, and I'm going over teachers code using debugger and dont understrand why the line age = getInt(IsValidAge); executes before printf, i thought C++ compiler executes lines sequentially. Any help would be … | |
Hello., I'm very new in C++, and I have a task to solve. I have a function: [CODE] void cio_display(const char *str, int row, int col, int len){ int i; cio_move(row, col); if(len<=0) { cio_putstr(str); } else{ for(i=0;i<len && str[i];i++) cio_putch(str[i]); for(;i<len;i++) cio_putch(' '); } [/CODE] here iss what i … | |
Hello! I'm new in C++, and I have a basic question: When I have a function: [CODE] void foo(str* s){ char* p; p = new char[strlen(s)]; strcpy(p, s); cout << s <<endl; } [/CODE] This function will take the length of s and in bytes and will allocate that much … | |
Hello guys, I'm very green in c++ and just started to understand classes and objects. I'm reading on the web about this pointer, but having difficulties understanding how it works exactly, could aanybody please help me understand or reference a good article for total noobs in c++ to grasp the … | |
[CODE] #include<stdio.h> class q1 { int id; public: q1() { id = 1; printf("mkdef: %d\n", id); } q1(int start) { id = start + 1; printf("mknew: %d\n", id); } ~q1() { printf("rm: %d\n", id); } int something(int n) { printf("La-de-da:%d\n", id); return n*(id+3);} }; void foo(void) { q1 one(1); one.something(4); … | |
Hello., Im very new to C++ but im trying to resolve a fragment of the following code: [CODE] #include <iostream> using namespace std; const int NO_STEPS = 4; void s(int* a, int i); int main ( ) { int i, a[NO_STEPS] = {2, 4, 1, 3}; for ( i = … | |
[CODE] #include<stdio.h> #define COUNT 5 void enter(int *p_arr); void report(int arr[], int count); int main() { int arr[5]; int i; for(i=0; i < COUNT; i++) { enter(&arr[i]); } report(arr, COUNT); } void enter(int *p_arr) { int i; int insert; printf("\nplease enter the number:"); scanf("%d", &insert); p_arr[i]=insert; } void report(int arr[], … | |
Hello guys, I'm trying to collect user input which combines integers with letters, but whenever it reaches the scanf for char it skips it and goes to next integer, could anybody explain why??? is it because main returns an integer,? I tried setting void main(void), and it sais that main … | |
hello., im trying to create a validation block that checks if the number is multiple of 5. im new at c, could anyone give me a tip? thanx a lot! cheers! | |
Hey guys! Could anyone enlighten me how to draw a graphic window in c? which classes to use and maybe a basic example would be greatly appreciated. cheers!! im using XCode and i assume it doesnt have all the libs like Borland, or Visual studio... cheers! | |
hello., in a few examples i noticed that pointers are declared in functions parameter list. ex [CODE] #include <stdio.h> void SwapEm (char *p_grade1, char *p_grade2); int main () { char grade1= 'D', grade2 = 'A'; printf ("At the beginning grade1 is %c and grade2 is %c\n", grade1, grade2); SwapEm (&grade1, … | |
hello., ny1 knows what is the data type for displaying hex numbers? i know that specifier is %x, but dont know what data type it is ex: 0xBCD thanx! | |
Hey guys, Im reading up on pointers and since i dont have a physical teacher, Its abit hard concept to grasp. Could anyone please explain in their own words shortly how they work, I understand that they carry the adress of another variable, and you'd assign this adress with an … | |
Hey guys, Im learning C online, and its hard somtimes to understand the concepts, w/o being in class asking questions. I was wondering hat would be the easiest and fstest way to understand numeric validating(no characters) and could anyone break it in easy steps? im new, but really excited about … | |
Hey guys., i wrote a little program to calculate the foreign exchange of canadian dollar to french frank. but when i validate an input(it has to be between 1 and a 1000), i get a problem even though it makes user to reenter the number, still the very first number … | |
Hello., Im learning C online, and one of the examples from the internet is this: [CODE] #include <stdio.h> int CalcVolume (int length, int width, int height); void PrintIt (int vol); void main() { int volume1, volume2; int x = 8, y = 15, z = 20; volume1 = CalcVolume (10, … | |
Hello again guys! i have a simple question how to promt user to enter a number for example 444 or whatever and for c to print it as a 9 digit number, so if its 444 c would print it as 000000444? any help would be greatly appriciated., thanx! | |
Hey Guys., Im super desparate have 1 day to hand this in. Have to use loops only. quote: The use of any of the following C statements or functions is not permitted under any circumstances. break; continue; exit(); abort(); No global variables. When the program starts it will prompt the … | |
Hey Guys! I have a weired one here, it must be a post-test loop, and here is how result has to look like: Enter the Section Code: 0 Invalid value entered. Must be 1 to 4, please re-enter: 1 Enter the Student's ID: 456789 Enter mark#1: 10 Enter mark#2: -20 … | |
Hello., I haveto check for non-numerci input, when reading numeric input. I know how to validate numeric input with while loop, but what if i need numeric input and user inputs alphabetic letter, any suggestions?? Thanx a lot! cheers! | |
Hey guys! I'm trying to calculate the average for student marks using pretest loop, and for some reason i get the wrong result, even though the code looks proper to me., there are 7 questions all of them totaling 100%, i haveto return average mark i HAVETO use pretest loop. … | |
Hello, Im taking C in school, and i have a problem with my code, nothing happens at all when i run the program. The task is: A program is required that prompts the user for a number. The program will then print a series of asterisks to represent the number. … | |
Hello., I'm working on my school assignment and the condition is to use post-test loop trying to get following result: --------------------------------------------------------------- Enter the Section Code: 0 Invalid value entered. Must be 1 to 4, please re-enter: 1 Enter the Student's ID: --------------------------------------------------------------- this is the assignment condition: When the program … |
The End.