6,741 Posted Topics

Member Avatar for schoenfelder.p

[QUOTE]Post your error code please.[/QUOTE] I agree. The code is more or less fine. The [ICODE]using namespace std[/ICODE] statement at the top of the date.h header could cause a problem, but that should have nothing to do with accessing public vs. private members. [QUOTE=Ketsuekiame]You're trying to access a private variable …

Member Avatar for Ketsuekiame
0
148
Member Avatar for bhosle

Unless you specifically pause execution or ask for input at the end of the program, the window should close on its own. However, some IDEs pause the window for you as a development convenience. I suspect you shouldn't need to worry about it, but how are you running the program?

Member Avatar for chiwawa10
0
116
Member Avatar for aaronmk2
Member Avatar for jdpjtp910

[QUOTE]I know it has something to do with my default constructor[/QUOTE] You're correct. That "something" is the fact that you don't have a default constructor. A default constructor is only generated for you if there are no other user-defined constructors in the class.

Member Avatar for Narue
0
184
Member Avatar for ayushi agarwal

[QUOTE]pointers are the most difficult topic in c language so don't take it easily[/QUOTE] Pointers are only the most difficult topic because people like you brainwash beginners into believing they're difficult. Pointers are in reality very simple.

Member Avatar for jephthah
0
101
Member Avatar for camdaddy09

[QUOTE=camdaddy09]Its come to my attention that some members of this board do NOT regard the feelings of others as any importance at all when considering a reply.[/QUOTE] One doesn't garner respect simply by having a pulse. Respect is earned through proving that one is worthy of respect. [QUOTE]This is contradictory …

Member Avatar for vegaseat
1
198
Member Avatar for ims@123

I'm not familiar with Netezza, but if it's an external application with command line functionality, or an application that exposes an API, or a web service, you can certainly send input and retrieve output using pipes. However, that's a rather platform-specific solution, so it would be best if you gave …

Member Avatar for abhimanipal
0
72
Member Avatar for jsphb9000

[QUOTE=jose jimenez] if you don't like the newline being included in fgets, then just remove it. [CODE]if (buffer[strlen(buffer) - 1] == '\n') buffer[strlen(buffer) - 1] = '\0'[/CODE][/QUOTE] Close. There's no point in calling strlen twice, especially since strlen has guaranteed O(N) complexity (barring clever tricks in the implementation). It's just …

Member Avatar for Aia
0
177
Member Avatar for cokaznsyco72

[QUOTE]my_printf.c: In function `[B][U]print_str[/U][/B]':[/QUOTE] I suspect you're not posting all of the relevant code. print_str isn't mentioned except in the error.

Member Avatar for jephthah
0
197
Member Avatar for kratosaurion
Member Avatar for nu2cpp

You clearly didn't do much searching before posting here, because MSDN has a knowledgebase article on this exact subject.

Member Avatar for Narue
0
97
Member Avatar for mcheng

Is CEA_Process forward declared prior to CEA_Disk_lister? Because as posted it won't exist and the definition of CEA_Disk_lister will fail.

Member Avatar for Narue
0
1K
Member Avatar for jephthah

Site navigation feels clunky now. I'm not sure what use cases you were using to design the site, but it's definitely more tedious to get around, in my opinion. I think it's this feeling of rough navigation that makes the whole site seem "bigger" and "harder to read". I'm not …

Member Avatar for Dani
8
2K
Member Avatar for s_sridhar

I suspect for people with kids it'll be when the kids were born. For married people, it's when they were married. For single people it'll be something selfish and silly, or the day they were divorced. ;) That should cover just about everyone. Do I win the thread?

Member Avatar for iamthwee
-1
254
Member Avatar for j.kelly

Can you give an example of how your headers look instead of just which includes the other?

Member Avatar for faaano
0
2K
Member Avatar for gear26926

[QUOTE=gear26926;1222654]The result for the given code snippet is i = -2, j = 3, k = 0, m = 1 Cud u please explain how u get this result?[/QUOTE] i is incremented, j is incremented, and both are not 0 (true), so k is not incremented. You're mixing two things …

Member Avatar for jephthah
0
116
Member Avatar for spartan118

The error is pretty detailed. Somewhere in the damagecalculation function you're trying to assign an integer to a string object. Check the function call to and verify your types.

Member Avatar for abhimanipal
0
102
Member Avatar for anuragcoder

Sorry anuragcoder, I'm going to ignore you now. Hopefully you'll realize that flooding the forum with bad questions is counterproductive and start concentrating on quality rather than quantity. In the meantime, here's some [URL="http://catb.org/~esr/faqs/smart-questions.html"]light reading[/URL] for you.

Member Avatar for daviddoria
0
116
Member Avatar for addxztion

[QUOTE]undefined symbol _main in module c0.ASM[/QUOTE] A complete C program requires an entry point. The entry point is called main; you may have heard of it. [QUOTE]where to put the printf("Enter values: ");?[/QUOTE] The main function that you're going to add. [QUOTE]in the scanf, what variable i would use? is …

Member Avatar for addxztion
0
169
Member Avatar for Brokenpwn
Member Avatar for Brokenpwn
-1
458
Member Avatar for skypower

Do it the same way you'd do it in Windows (open the file in binary mode and use the read/write functions). This can be done with standard code, though the contents of the file will not be portable due to implementation-defined padding between structure members. So your file can't be …

Member Avatar for skypower
0
131
Member Avatar for purvi12345

[QUOTE]implentation of m-ary tree in C[/QUOTE] If you understand the concept then an implementation isn't terribly difficult with a little effort on your part. So go do your own homework. We won't bail you out. kthxbye. [QUOTE]any simple example?[/QUOTE] No. In my experience, people asking for "simple" examples of something …

Member Avatar for Tellalca
-3
1K
Member Avatar for merse

[QUOTE]The packages are different under XP and linux?[/QUOTE] No. Your code under Windows was benefiting from internal includes. That is, standard headers themselves include other standard headers, which means somewhere in <iostream>, for example, <cstdlib> was included. atof is declared in <cstdlib>, so your calls magically worked. It's best to …

Member Avatar for Narue
0
680
Member Avatar for helpfullProgram

[QUOTE]I wondered if like vector<int> I could do vector<char[20]> but it doesn't seem to work, your ideas?[/QUOTE] No. Arrays don't meet the basic requirements of types suitable for storage in a vector (ex. assignment isn't allowed on arrays). You could use a dynamic C-style string and store char* in your …

Member Avatar for mrnutty
0
165
Member Avatar for skypower

[QUOTE]eisodos1[i]=getchar(); (1) (1) assignment makes pointer from integer without a cast (I dont even know whats a cast)[/QUOTE] eisodos1 is an array of pointers to char. getchar returns an integer. There's obviously a type mismatch here. You're trying to assign an integer to a pointer. [QUOTE]e=eisodos1[i]; (2) (2) assignment makes …

Member Avatar for eager
0
193
Member Avatar for prototyppe
Member Avatar for NathanOliver
0
62
Member Avatar for Roses89

vector<int> is a type, but those member functions are expecting an actual object of the type.

Member Avatar for Roses89
0
58
Member Avatar for trillionaire

Your Point class doesn't have a copy constructor. Passing objects of that class around by value is an exceptionally bad idea since the data members are dynamically allocated. Default copy construction won't work in this case.

Member Avatar for Narue
0
150
Member Avatar for chained

fputc writes a single character to the specified string. If you want to convert an integer to a string and then write it to your file, fprintf would be the easiest: [code] fprintf(fp, "%d\t%s\n", temp.number, temp.description); [/code]

Member Avatar for chained
0
129
Member Avatar for Martje

[QUOTE=Martje;1220975]when you have 2 pointers pointing at the same address isn't it the-same as a reference pointer(*&)?[/QUOTE] No, it's not. What makes you think so?

Member Avatar for Narue
0
35
Member Avatar for JohnJ_21

>if you wanna do it... that would be awesome Sorry, but that's not going to happen. We're not a homework service. >Can anyone help me code this?? No, but we can help you understand it and help you correct and problems in the code you write as well as suggest …

Member Avatar for WaltP
0
144
Member Avatar for rickymak

[QUOTE]I am not sure what EOF is on the keyboard or what triggers it.[/QUOTE] If you're on Windows, the Ctrl+Z key combination sill signal end-of-file and cause getchar to return the EOF flag rather than extract a character from the stream. On Unix/Linux, the key combination is Ctrl+D.

Member Avatar for Aia
0
191
Member Avatar for coding101

You don't need an array, this can be done by streaming the numbers to the output file directly using a merge algorithm. The merge algorithm is straightforward, and I'll encourage you to see what you can come up with on your own. However, merging is a common task, so you'll …

Member Avatar for mrnutty
0
104
Member Avatar for hassall

Did it not occur to you that you can upgrade to a more modern compiler? You should be aware that C is no longer the same language it was when Turbo C came out. Not to mention compilers in general have improved [i]drastically[/i] in the last twenty years.

Member Avatar for hassall
0
212
Member Avatar for Dave Sinkula

[QUOTE=camdaddy09;1219697]why is scanf() unreliable and unwanted?[/QUOTE] scanf can be reliable when used correctly, but it's typically unwanted for string input because achieving reliability in that case is more difficult than simply using a more appropriate function. For example, here is fgets simulated using fscanf: [code] char *myfgets(char *dst, size_t limit, …

Member Avatar for Narue
0
2K
Member Avatar for merse

[QUOTE=merse;1219090]But I dont want to use string manipulation, if it is possible, because its very simple, and I want to read numbers,[/QUOTE] What's the format of your file?

Member Avatar for Narue
0
800
Member Avatar for BLKelsey

Example to get you started: [code] #include <ctime> #include <iomanip> #include <iostream> using namespace std; void wait(int seconds) { clock_t endwait; endwait = clock() + seconds * CLOCKS_PER_SEC; while (clock() < endwait) {} } int main() { const int dots = 3; const int n = 5; cout<<"LOADING"; for (int …

Member Avatar for BLKelsey
0
107
Member Avatar for gunbuster363

[QUOTE]how can we catch this end of file to signify end of program?[/QUOTE] On Windows you can use the Ctrl+Z key combination to signal end-of-file. On POSIX systems you can use Ctrl+D. In code, it's pretty much the same pattern as with files: [code] int num; // Read numbers until …

Member Avatar for Sky Diploma
0
348
Member Avatar for SpyrosMet

[B]>So have your routine choose either 0 or 1 (so use rand() % 2) >and then select the appropriate number with an if statement.[/B] [ICODE]rand() % 2[/ICODE] is especially risky when it comes to getting the same result every time (for reasons I'm not interested in detailing at the moment). …

Member Avatar for Narue
0
531
Member Avatar for Atlanticspace

If you want to leverage polymorphism you should be using an array of pointers to the base class. The array itself doesn't need to be passed by reference because it's already passed as a pointer to the first element (simulated pass-by-reference).

Member Avatar for Narue
0
169
Member Avatar for newcoder192

[B]>vector<int> ints; // dynamic array of ints[/B] No, it's a vector of int. I very much doubt that's what the OP was thinking of when saying "dynamic array". :icon_rolleyes: [B]>char* str; >while (cin >> str) ints.push_back(atoi(str)); // adding[/B] Really? Shall we explore the fact that this is probably the most …

Member Avatar for Narue
0
83
Member Avatar for apurva agarwal

>I would be highly grateful if u give me the code I'm sure you would. Do your own work, it's much more rewarding.

Member Avatar for asim88
-1
420
Member Avatar for SquirrelProdigy

[code] #include <algorithm> #include <cctype> #include <iostream> #include <string> using namespace std; int lower_case ( int c ) { return tolower ( c ); } int main() { string s = "THIS IS A TEST"; transform ( s.begin(), s.end(), s.begin(), lower_case ); cout<< s <<endl; } [/code] Before you ask, …

Member Avatar for yangacer
0
169
Member Avatar for aloush91

[B]>i like all of u[/B] I believe I can cure you of that. [B]>plz if anyone knows plz help me[/B] Dude, slow down and take the time to compose a [URL="http://catb.org/~esr/faqs/smart-questions.html#writewell"]coherent post[/URL]. This isn't a chat room. You've got all the time in the world to make your posts presentable …

Member Avatar for Banfa
0
177
Member Avatar for Sodabread

[B]>Shouldn't the terminology be taught early on >with stuff like cout, variables and if statements?[/B] If only it were that easy. For example: super/sub, parent/child, base/derived. They all mean the same thing. Good luck teaching which one is appropriate in which situation without completely confusing the student. The problem isn't …

Member Avatar for jwenting
1
162
Member Avatar for tquiva

[B]>I just can't seem to compile it. >Will someone please give me some suggestions?[/B] I'd suggest reading the errors, tracing the source of the problem, and applying a fix to the code. What were you wanting us to do? Debug your code and give you the working program? Do you …

Member Avatar for jephthah
-1
616
Member Avatar for Xufyan

[B]>and why we are checking this condition ?[/B] [ICODE]if(num[i]>num[j]) [/ICODE] Why would you want to swap items that are already in the correct order?

Member Avatar for sourabhtripathi
0
99
Member Avatar for speedy94519

[B]>Could someone give me some advice?[/B] Not without seeing any code, no. Your problem appears to be a runtime error more than confusion about true and false. [B]>TRUE and FALSE are defined, as 1 and 0 respectively, in stdbool.h for C99.[/B] They're both lower case, actually: [code] #define bool _Bool …

Member Avatar for jephthah
0
118
Member Avatar for robski

scanf fails if it can't convert the incoming stream into a valid number, and it doesn't extract the bad characters. So unless you extract them yourself you'll get an infinite loop as scanf continues to fail on the same stuff. [code] // Unsafe; risks an infinite loop while (scanf("%d", &x) …

Member Avatar for Narue
0
116
Member Avatar for seyho

[B]>What's the prize??[/B] The prize is full marks to the OP if he can convince some rube to help him cheat on his homework.

Member Avatar for Salem
-2
153

The End.