2,384 Posted Topics
Re: You could edit your image tags to look like this: [[COLOR=Black]IMG[/COLOR]]http://www.computersforpennies.com/error.gif[[COLOR=Black]/IMG[/COLOR]] Then you will see this: [IMG]http://www.computersforpennies.com/error.gif[/IMG] | |
Re: Look [url=http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1043803465&id=1043284385]here[/url] and [url=http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1042856625&id=1043284385]here[/url]. | |
Re: [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1043372399&id=1043284385#opt3[/url] | |
Re: A word is a sequence of non-whitespace characters separated by whitespace. Use a flag to indicate when you are in whitespace or not. Going from non-whitespace to whitespace would be the end of a word. | |
Re: Post the code you've got between CODE tags. [Quid pro quo](http://www.daniweb.com/techtalkforums/announcement.php?f=8&announcementid=2). | |
Re: [code] sort(totalScore[COLOR=Red][][/COLOR], 100, student[COLOR=Red][][/COLOR]);[/code]Remove the empty brackets. [code]display(student, totalScore[COLOR=Red][i][/COLOR]);[/code]The prototype calls for an array, you are passing a single element. [code] int i; cout << student[i].name << endl;[/code]Uh, shouldn't i be given a value? [code]void swap(double totalScore[], int i, int j) void swap2(Student student[], int i, int j) swap (totalScore[i], … | |
Re: >#include<iostream.h> >#include<conio.h> Nonstandard headers. >#include<stdio.h> Unused header. >void main() Incorrect. >clrscr(); Unnecessary and a nonstandard function. > n[c] = 55 + r; > n[c] = 48 + r; ASCII hacks. >getch(); Nonstandard function. | |
Re: I'd need the complete code to get it to compile. And if you want anyone to take a really good look at code, use [CODE] tags. But why do you have a strangely worded loop here? while ( st_line[x] != '\0' ) | |
Re: You're not using an input function that skips whitespace (which includes newlines), are you? | |
Re: >what is the vvalue of strcmp(s2, s3)<0 1 >"Please explain" You try. We'll help. | |
Re: [QUOTE=craigt]While a runtime init would work I need a build-time init. The project target is a small 8 bit processor and I don't need the extra overhead that a runtime init would add. The first init that I listed in the original post is probably as small an init as … | |
Re: You forgot to update the loop counter. [code]while(n>0) { x=n%10; sum+=x; [COLOR=Blue]n/=10;[/COLOR] }[/code] | |
Re: The C-style string handling functions are declared in <[COLOR=Blue]c[/COLOR]string>, not <string>. | |
Re: [QUOTE=Archer][code] getch(); main(); } main() { int i[N],e; clrscr();[/code][/QUOTE]Yeeeeeeeeech! | |
Re: [QUOTE=boujibabe]You're right, any help on improving the one I did already simply?[/QUOTE] Don't use magic numbers like 5 and 65. | |
Re: [QUOTE=Moo The Cow]When I run the program, it doesn't print the "Hello, world!", but I just see a dos window quickly flash on my screen. What (and where) should I add to this code to prevent this?[/QUOTE][url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1043803465&id=1043284385[/url] | |
Re: [code] for ( i=1 ; i<[color=red]=[/color]10 ; i++ ) cout<<arr[i]<<" "; [/code]You went beyond array bounds. You should do this:[code] for ( i=0 ; i<10 ; i++ ) cout<<arr[i]<<" "; [/code] | |
Re: [QUOTE=Asif_NSU][COLOR=Blue]I want to take integer inputs separated by spaces and terminated by newline character.[/COLOR] suppose the user will be inserting integers this way 123 566 789 45 34 8999 341 57 67 and then the user presses enter. so the program will read all the integers when the user presses … | |
Re: [code]#include <stdio.h> int main ( void ) { int array[] = { 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 }; size_t i; for (i = 0; i < sizeof array / sizeof *array; ++i ) { printf("%10d[COLOR=Blue]%c[/COLOR]", array[i], [COLOR=Blue]i % 5 == 4 ? '\n' : ' '[/COLOR]); } return 0; } /* my output … | |
Re: [FONT=Courier New]argv[1][/FONT] and [FONT=Courier New]argv[3][/FONT], if available, are strings. Convert them to integers before attempting to add them; [FONT=Courier New]atoi[/FONT] may be useful for this. [FONT=Courier New]argv[2][/FONT] is a string also. Use [FONT=Courier New]argv[2][0][/FONT] for the first character. [edit]D'oh! Didn't even look at [FONT=Courier New]main[/FONT], which should be declared like … | |
Re: [code]#include <stdio.h> int main ( void ) { char caption [ 3 ]; int letter, number; for ( letter = 0; letter < 5; letter++ ) { for ( number = 0; number < 5; number++ ) { [COLOR=Blue]sprintf ( caption, "%c%d", letter + 'A', number + 1 );[/COLOR] printf … | |
Re: Describe, in English sentences, what you think the data types are for the following:[list][*][FONT=Courier New]naam[/FONT] [*][FONT=Courier New]temp[/FONT][/list] | |
Re: Check return values. Always use { and } to enclose code blocks. Indent properly. [url]http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.5[/url] | |
Re: >can someone tell me what static does to the function? [url]http://www.embedded.com/98/9811/9811fe3.htm[/url] about halfway down, although the whole article is worthwhile. | |
Re: Wow. Don't break a sweat. Code blocks are done by indention. | |
Re: [QUOTE=Stack Overflow]Another Example:[code][color=blue]#include[/color] <stdio.h> [color=blue]int[/color] main() { [color=blue]char[/color] ch[25]; [color=blue]char[/color] *p; p = &ch[0]; scanf(“%s | |
Re: How about this? [code]#include <stdio.h> [COLOR=Blue]char dummy [ sizeof(int) == 4 ];[/COLOR] int main(void) { return 0; }[/code] | |
Re: [code] #include <stdio.h> int main(){int*i,*j,a[]={10,20,30,40,30};for(i=a;i<&a[sizeof a/sizeof*a];++i){for(j=a;j<i;++j){if(*i==*j){break;}}if(i==j){printf(&",%d"[i==a],*i);}}putchar('\n');return 0;} [/code] | |
Re: [url="http://www.catb.org/%7Eesr/faqs/smart-questions.html#writewell"]http://www.catb.org/~esr/faqs/smart-questions.html#writewell[/url] | |
Re: Behavior is undefined since [font=Courier New]ptr2[/font] does not point anywhere. | |
| |
Re: [QUOTE=sjopkg]I also need help getting started on this same program. But I don't even know where to start... any help would be great![/QUOTE][code]// your code here int main() { // your code here return 0; }[/code] | |
Re: [url="http://www.dinkumware.com/manuals/reader.aspx?lib=cpp"]http://www.dinkumware.com/manuals/reader.aspx?lib=cpp[/url] [url="http://www.cppreference.com"]http://www.cppreference.com[/url] [url="http://groups.google.com/groups?hl=en&lr=&group=comp.lang.c%2B%2B"]http://groups.google.com/groups?hl=en&lr=&group=comp.lang.c%2B%2B[/url] | |
Re: [QUOTE=prathys]I came across a strange thing when doing program in c++ in visualc++ environment.just run this code and after entering the array elements press up arrow and down arrow.[/QUOTE]Would you mind telling us what this "strange thing" was? Or might you be marvelling at the command shell in which your … | |
Re: The simple and not so great way of iterating through the array to see if it is a duplicate and discarding it may go something like this. [code] #include <stdlib.h> #include <stdio.h> #include <time.h> #define SIZE 100 #define MAX 1000 int main(void) { int array[SIZE]; size_t i,j; srand(time(NULL)); for ( … | |
Re: [CODE] #include <iostream> #include "Erfn.h" int main() { Erfn var; for ( double i = 0; i < 4.25; i += 0.5 ) { std::cout << "Erfn(" << i << ") = " << var(i) << std::endl; } return 0; } /* my output Erfn(0) = 0 Erfn(0.5) = 0.5202 … | |
Re: [QUOTE=sjopkg]Any help on getting started would be awesome!!![/QUOTE][code]// your code here int main() { // your code here return 0; }[/code] | |
Re: [url="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1047673478&id=1043284351"]Casting malloc[/url] [code]int *a = malloc(10 * sizeof *a);[/code] | |
Re: Maybe your issue is related to the missing [font=Courier New])[/font]. [code] if(strcmp(h.depart,"Sales")==0[/code] [EDIT]Oh, wait! Are you compiling C++ code in a C compiler? | |
Re: Post what you've got -- and please enclose code within code tags | |
Re: >>Can someone please help me with a statement to calculate the median when the array is even. >Take the median of the two middle items: a[size / 2] and a[size / 2 + 1]. Wouldn't that be the [i]mean[/i] of [font=Courier New]a[size / 2][/font] and [font=Courier New]a[size / 2 [/font][font=Courier … | |
Re: Please read the [url="http://www.daniweb.com/techtalkforums/announcement.php?f=8&announcementid=2"][b]Announcement[/b][/url]. | |
Re: Maybe you were planning to implement your ShowDate function and call it before exiting, but you didn't. | |
Re: [url]http://groups.google.com/groups?q=%22error%20spawning%20cl.exe%22[/url] | |
Re: [URL]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044873249&id=1043284392[/URL] | |
Re: I generally use the % operator. [CODE]#include <stdio.h> int main(void) { int i = 1; while ( i <= 50 ) { printf("%3d ", i); [color=Blue]if ( i % 10 == 0 )[/color] { putchar('\n'); } ++i; } return 0; } [color=Sienna]/* my output 1 2 3 4 5 6 … | |
Re: >the problem is how do i put the results in a histogram form. Are you saying you would like output something like this? [CODE] $200-$299 : 1 * $300-$399 : 2 ** $400-$499 : 1 * $500-$599 : 4 **** $600-$699 : 6 ****** $700-$799 : 2 ** $800-$899 : … | |
Re: > Any help would be greatly appreciated. [CODE]#include <stdio.h> float get_lat1(void); int main (void) { float latitude = get_lat1(); printf("the value of latitude is %f \n", latitude); return 0; } float get_lat1(void) { int degrees, minutes; float seconds, latitude = 0; char direction; printf("Enter the Prepare to enter data for … | |
Re: [CODE]#include <iostream> #include <cstdlib> using namespace std; // for toy programs bool getEmployeeData(int [color=Blue]&[/color]ID) { cout << "Enter employee ID: "; cin >> ID; if ( ID >= 0 ) { return true; } return false; } int main() { int id; if ( getEmployeeData(id) == false ) { cout … | |
Re: It looks like you forgot to read the http://www.daniweb.com/techtalkforums/announcement.php?f=8&announcementid=2 announcement. Post the code you have, but wrapped in code tags. |
The End.