121 Posted Topics
Re: Hello chess 2009, Empty lines are displayed if there are multiple spaces between the two words. Try this logic in the [COLOR="Green"]if else[/COLOR] block. If there are one or more spaces between the set of characters,the cursor should go to next line.Try this... [CODE]if(c!=' ' && c!='\t' && c!='\n' && … | |
Re: Hello george61, I think the problem is in the for loop which reverses the array. [CODE]for(int i = (str1size - 1); i>=0; i--) { n = (str1size - 1) - i; str2[n] = str1[i]; //<-- problem }[/CODE] I think the whole string("9009" or "2345") gets into str2[n] without getting reversed, … | |
Re: You can use do while loop for the whole block and give the condition in the do while loop as... [CODE]}while(yn!='y');[/CODE] | |
Re: No.Both abort() and exit() terminate the program and not the function only. Abort() ends the program with "abnormal program termination".It indicates unsuccessful termination of program. | |
Re: Hello stan2000, The problem is in your for loop. You initialized total_pay as 0.01. Inside the for loop total_pay gets added to pay*2 which value on day 1 becomes 0.03( that is 0.01+ (0.01*2)). so the total_pay will not start from 0.01. To start total_pay from 0.01 you should initialize … | |
Re: Hello slygoth, There is a simple way to do this. Initialize a character a and write [COLOR="Green"]a=getch()[/COLOR]. This would not display the character entered by the user. [CODE]char a; a=getch(); // varable a will have the character entered by the user.The character cout<<'*'; // entered by the user will not … | |
Re: Hello slygoth, You should include ctype.h for using toupper. To convert lowercase letter to uppercase you should give [CODE]pick=toupper(pick); [/CODE] If the user enters 'a' you can convert it to 'A' using the above. | |
Hello friends, I am trying to play music through turbo c++.I used Irrklang sound library 1.3.0. But while compiling i get an error saying "unable to include IK_IRRKLANGTYPES.h" and other header files. Should i change anything in header files? Is there any other way to play music in turbo c++? … | |
Re: Hello Lokril, try this.... [CODE]#include<iostream.h> #include<conio.h> int remainder(int x,int y) {int d,e; d=x/y; e=x-(y*d); return(e); } int main() {. . .// code that you just posted }[/CODE] | |
Hello friends, I am having a trouble with dosbox 0.72. I opened turbo c++ using dosbox and tried a program. But it throws an error 'unable to create hello.obj'. my program [CODE]#include<iostream.h> #include<conio.h> void main() { cout<<"hello"; }[/CODE] I gave this while opening turbo c++ in dosbox... Z:\>mount c d:\turboc3\ … | |
Hello friends, I am having a trouble with dosbox 0.72. I opened turbo c++ using dosbox and tried a program. But it throws an error 'unable to create hello.obj'. my program [CODE]#include<iostream.h> #include<conio.h> void main() { cout<<"hello"; }[/CODE] I gave this while opening turbo c++ in dosbox... Z:\>mount c d:\turboc3\ … | |
Re: Hello madmark, you have declared 'a' twice,one in the begining and other in the for loop. So the compiler will throw an error("multiple declaration error"). Try this... [CODE]for(a=0;a<1000;a++) { c=(a*a*a)-(a*a); if(b==c) { printf("%d",a); } } [/CODE] | |
Re: your program works finely.But it throws floating point error if the value of b*b is less than 4.0*a*c,because sqrt are not meant for negative numbers. Also use getch() at the end of the program before return(0),so that the output is displayed till you press a key. getch() prototype-conio.h | |
Re: Hello sudipan007... a=1 and not a==1. [CODE]if(i%j==0) {a=1; } [/CODE] | |
Hello friends.Can anyone help me in this.Here is the code. [CODE]circle(320,240,100); textmode(BW40); cout<<"\n\n\n\n\n\n\n\n\n\n\t\thello";[/CODE] The problem is hello is displayed without circle. ![]() | |
Re: you have declared the array having 64 elements only(char pste_msg[64]) ----- | |
Re: strings are collection of characters that you enclose it with double quotes. eg: [CODE]char a[5]="world";[/CODE] a[0] will have w a[1] will have o a[2] will have r a[3] will have l a[4] will have d. | |
i want an .exe file to be automatically executed if a folder having that particular file is opened,that's if you open the folder the file should get executed automatically.I want this to do in c++.can somebody help??? | |
can somebody explain me about parameters in initgraph in c++ graphics??? | |
Re: An array is a collection of elements of same datatype. int a[100]; the above is an example of integer array having hundred values. accessing array... for(c=1;c<=100;c++) cin>>a[c]; //accepting integer values from the user. | |
Re: here is a simple method to sort strings using bubble sort [code=c] #include #include #include #include void main() {clrscr(); int c,d,e,f,g,h,i,j,k,l; char a[100][100],b[100]; cout<<"how many strings you are going to enter"; cin>>d; for(c=0;c<=d;c++) gets(a[c]); for(c=0;c0) {strcpy(b,a[c]); strcpy(a[c],a[c+1]); strcpy(a[c+1],b); } } } for(c=0;c |
The End.