1,088 Posted Topics
Re: If all that you are going to do is to use C++ to make calls to commands to the CLI , why don't you just make a script in bash with those commands?. | |
Re: [code=C]#include<stdio.h> int main(void) { char string[50]; char *ptr = string; printf("Enter string\n"); fgets(string,sizeof string,stdin); printf("string= \"%s\"\n",string); /* first letter of string */ *ptr = toupper(*ptr); /* going thru string */ while(*ptr) { if( isspace(*ptr) ) { *(++ptr) = toupper(*ptr); } ++ptr; } printf("The new string is %s",string); getchar(); return 0; … | |
Re: [quote=brightmohan;359904]Here is the SAMPLE.C where gets() works absolutely fine. I dont understand why it isnt working in PROGRAM.C [code=c] #include<errno.h> #include<stdio.h> int getline(char line[], int max) { int nch = 0; int c; max = max - 1; /* leave room for '\0' */ while((c = getchar()) != '\0') { … | |
Re: [quote=Salem;354737]The first problem to fix is to get a new keyboard. It seems the 'p' and 'z' keys are a bit on the sticky side. [inlinecode]ppppppprintf("hello world");[/inlinecode] just isn't going to compile properly. [/quote] Is a special feature coming up now. Designed for writing code with arrays. | |
Re: >if the current number is larger than the previous one, it gets printed to screen, if not, it gets ignored What happens if the current number is larger that the previous one, but smaller than the one before the previous one? How would you know that? | |
Re: [quote=jerryseinfeld;354782]thank you so much last question.. what does rewind ???[/quote] Are you refering to rewind()?. rewind() is a file pointer (not the same that pointers) function. It reset the file pointer back to position 0 at the start of the file. You deal with file pointer when you work with … | |
Re: [quote=Zay;354647]Hello; can any 1 tell me what is the answer for the following statement : 1%10 and 1%2 :)[/quote] Is you question what is it and how it works?. Look for the modulus operator. | |
Re: >while((temp != -99) || (temp != 212)); change the || for a && | |
Re: [quote=revenge2;341048]Hello there, does anyone know of any free beginner c++ videos on the net? . Thanks-:cheesy:[/quote] Take a look [URL="http://www.softwaretrainingtutorials.com/c-plus-plus.php"]here[/URL] It's not entirely free, but a demo is free so you can see what you would get. | |
Re: Is not only fuel == "Petrol" the once with problems. You are trying to compare the value of an integer `fuel` with an array of characters. All the if that you have with strings will give you an error. When you include a word among " " it became a … | |
Re: [quote=joeprogrammer;349103]> But in this circumstance, i nedd [B]wires.inp [/B]not [B]wires.txt. [/B]What do you think? :icon_rolleyes: Rename wires.txt to wires.inp and your program should work like a charm.[/quote] He is already trying to open it with the right file name. FILE FILE *fwiresInp=fopen("C:\\ctemp\\vuth\\wires.inp","r"); Could it be that fopen()is the wrong function … | |
Re: Some of your problems: line 62 and line 86: Two different functions with same name. line 67 "counter" and "number" are two variables that the function doesn't see from inside main fuction and the loop do-while. line 61 and 85 two end main?. line 71: At this point your curly … | |
Re: [quote=psuspect;347091]I have this simple program that counts characters in a line as well as a specific character z and Z. I am trying to figure out the simplest way to output my results to a file "outfile.txt". any ideas?[/quote] Without modifying your code too much, this could be a solution. … | |
Re: [quote]#include <malloc.h> free ( name );[/quote] Not need it here. void main() should be int main(void) | |
Re: [quote=thekashyap;346775] make it: [inlinecode]void sum(int, int[igg][jgg]);[/inlinecode] and it should work[/quote] This would work also: [code]void sum(int, int[][jgg]);[/code] | |
Re: [quote] while( fgets( buffer, 256, fp ) [COLOR=Red]! == [/COLOR]NULL )[/quote] This is an error. Most like it you want [COLOR=Blue]!= [/COLOR][quote] fprintf(LPT1, "%4d:\t%s", line++. buffer );[/quote] LPT1 is suppost to be a file open already and declared. Compiler do not have knowledge of what LPT1 is. | |
Re: [quote=naya22;346199]Hi. I'm currently working on a program that requires me to use arrays. Does anyone know a good tutoring site that I can go to?? Thanks![/quote] For 2-D arrays [URL="http://www.mtsu.edu/%7Ecsci117/manual/lab14/lab14.html"]here you are[/URL]. | |
Re: [quote] hi,this sandy patel[/quote] Hello :). Welcome to the forum. Let's start from the beginning. I hope you are not expecting people to do your home work. In fact, is opposite to the philosophy of this forum to do that. Read about it,[URL="http://www.daniweb.com/techtalkforums/announcement8-2.html"] here[/URL]. Now that you know that. Let's … | |
Re: This link will guide you in many functions that deal with characters and string in C [URL]http://www.cppreference.com/stdstring/index.html[/URL] | |
Re: This [URL="http://www.mtsu.edu/%7Ecsci117/manual/lab14/lab14.html"]link[/URL] might help you understand a little more. | |
Re: My friend, I think you are having trouble how functions works :confused: I am not an expert in C++ but I can see a couple things wrong with how you make use of functions. [code] void makeSieve ( bool sieve[], const int sieveSize ) { for ( int i=2; i … | |
Re: [quote=Manzar;340582]Write a C/C++ program which consists of a user-define function Prime. This function will take a number and check that the number is prime or not if the number is prime Display The number is Prime other wise display The number is not Prime Call this function in main program.[/quote] … | |
Re: [quote=pc0019;341670]Hi which it did, but still exits when I press enter; which is not ideal for programs which require it. PC[/quote] I have a concern that you are "placing the carriage in front of the horses". I would encourage to keep learning and you will learn about flow control top-down. … | |
Re: [quote] Can any one spot why this listing Will not compile?[/quote] [code] /*print_it.c-This program preints a listing with line numbers */ #include <stdlib.h> #include <stdio.h> void do_heading(char *filename); int line = 0, page = 0; int main( int argv, char *argc[] ) { char buffer[256]; FILE *fp; if( argv < … | |
Re: [quote=brndn_sadler;341567]I Downloaded A Game Called Hitman Blood Money On Bit Torrent And Now I Can Get It To Play What Should I Do? Email Me At [EMAIL="brndn_sadler@yahoo.com"]brndn_sadler@yahoo.com[/EMAIL] With A Detailed Answer. Cause I Suck At This.[/quote] Wrong forum, buddy.:) | |
Re: Allow me to help you by guiding you to this pertinent [URL="http://www.daniweb.com/techtalkforums/announcement8-2.html"]link[/URL] | |
Re: [quote=ajaxjinx;341263]If u can be of help then it OK otherwise stop F@#king replying to mu thread...[/quote] [quote=ajaxjinx;341263] Mr CoolDude (i am thwee), Please Post iff u can be of any help :) [/quote] ajaxjinx, please don't take it personal. I am quite sure that Iamthwee nor Salem were trying to … | |
Re: [quote=Green Anorak;341558]Hi All I am very new to C and would appreciate your help. I am trying to create a program which reads a file (a list of numbers) and prints to the screen those which are higher than 0.7. Does anyone know how to do this? So far I … | |
Re: I found this snippet about the subject, maybe it would help you, maybe not, but here it is: [url]http://www.daniweb.com/code/snippet445.html[/url] [COLOR=#cc0000][COLOR=#0000ff][/COLOR][/COLOR] | |
Re: At the bottom of this posted page there's a couple links from posts related to your query. One of them might help you: [URL]http://www.daniweb.com/techtalkforums/thread19621.html[/URL] | |
Re: [quote=wujianwei;341320]I have been wondering the definition... I mean, [B]Are both 00123 and 12345 five-digit numbers?[/B][/quote] Is a question with a trick?. Yes, both are five-digit numbers. 00123 has a value of 123 units but is a five-digit number. | |
Re: [quote=Salem;341259]My clairvoyant skills tell me the problem is on line 12 of your code. [/quote] Salem you better reacquaintance yourself with the powers of BE. The problem is in line 22. :cheesy:. I saw it very clearly in my mind as soon as I clicked in this post. By the … | |
Re: [quote=mrjoli021;340988]I have a two dimensional array that I need to make into a global variable to be able to access it from other functions. I can't quite figure out what the correct syntax is. [/quote] Put them any where before the main function. Kind like the same way you put … | |
Re: >double i,b; Don't use a float or double for index in a loop. Use a integer if you want correct results. | |
If you would have to write your own implementation of the function [COLOR=Blue]getchar()[/COLOR] in C; how would you do it?. | |
Re: Take a look at this link: [URL="http://guideme.itgo.com/atozofc/ch09.pdf"]http://guideme.itgo.com/atozofc/#contents[/URL] in section 9 under recursion there's some guidance for you about a Finobacci function Edit: Sorry, it appears that you need to copy and paste this link in the web browser, if not it give you a forbidden message | |
Re: [quote=Senel;340349] It gave two condition either true or false (1 or 0) then....[/quote] Have you tried this in a function?: [code=Cplusplus] return( first_number % second_number == 0 );[/code] | |
Re: [quote=Ancient Dragon;339460] then yes, you can read the novel War And Peace between compiles.[/quote] Good one :). Not only do programming work but also you get educated in literacy. | |
Re: The function doesn't have to return a value to be able to display what the year is. [code=C]void leapYear(int year) { if((year % 100) == 0 ) { printf("%d is a century year\n", year); } else if(((year % 4) == 0) || ((year % 400) == 0)) { printf("%d is … | |
Re: [quote=7arouf;338838]hi can anyone tell me what do we mean by: system( "PAUSE" ); and system( "CLS" ); in C++ thanks[/quote] system("PAUSE"); the program waits for you to enter a key system("CLS"); clears the console or command line terminal both of makes your program not portable since is operating system depended | |
Re: [quote=mrjoli021;337904]I dont know the systax for the two dimensional arrays.[/quote] two dimensional array is a funcy way of say an array of arrays, and you will declare it pretty much like a regular array. example: [code=C]char array[3]; /* This is an array of 4 elements */ char array[2] [3]; /* … ![]() | |
Re: [quote=Salem;337919] To actually read it, use getch()[/quote] Oh... oh!. You are going to hear about this one. :) | |
Re: [quote=CRD;337839] the compiler gets to the first line with "STDPRN" it stops compiling and says Undeclared reference [/quote] That's because there's nothing said about "stdprn" in any of the #include header files that you have included. In any case I don't see "stdprn" in the code that you provided. But … | |
Re: [quote=afr02hrs;336911]Can anyone spot the semantic error in this triangular number calculator here? [code] ReadIntPr("Enter number for testing: "); WriteStringCr("Triangular"); Again = ReadCharPr("Test another number (y/n)? "); } [/code][/quote] Are you including the proper #defines at the beginning of the source file?. Are you providing the proper prototypes for those functions. … | |
Re: See if you can do the function for the next two loops. Take notice how and where to prototype. [code=C]#include <stdio.h> void while_blasting(int counter); /* prototype */ int main(void) { int loopcount = 5; while_blasting(loopcount); /* call to the function */ getchar(); return 0; } /* function using a while … | |
Re: [quote=nikkidee;334407]Can anyone tell me why I'm getting build errors on the actual function heading and the line under it (**) saying "type bool is unexpected" and that I'm missing a ; before {? I've looked and can't find anything. Also, I get this error but there is no line 80 … | |
Re: Friend, you question is fully-loaded. It is one of those questions that are very easy to formalate but requires a lot to explain. I include a couple links that maybe can help you to understand: [URL="http://pw1.netcom.com/%7Etjensen/ptr/pointers.htm"]Here's[/URL] one, and [URL="http://www.eternallyconfuzzled.com/tuts/languages/jsw_tut_pointers.aspx"]here's[/URL] the other. Have fun! | |
Re: Maybe this [URL="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1031963460&id=1043284385"]link[/URL] could help how to go about clearing the screen in a console You could also use a simple[COLOR=Navy][I] getchar()[/I] [/COLOR]instead of the non-portable [COLOR=Navy][I]getch()[/I][/COLOR] | |
Re: > i have tried to change it int i; double D_Nath[11],D[11],er[11]; for( i=0;i < 11; i++) { D_Nath(i)=PI*D(i)/er(i)*.76554; } > > this is what I have for the code but I am getting a C2064 error in the line with the D_Nath(I)= > any idea what I am doing wrong … | |
Re: [quote=hbk619;332708] [code] void turn(int total, int other); void draw(int total); void neg(int total, int other); [/code] [/quote] These prototypes should be before the [I]main()[/I] function or in another head of file included, so the compiler can see what are they. Also the[I] int total[/I] and [I]int other[/I] that you wrote … |
The End.