Can you post the errors you got ?
tomato.pgn commented: yes..he was a great mathematician +0
Arbus 25 Practically a Master Poster
Arbus 25 Practically a Master Poster
Can you post the errors you got ?
I tried what you said WaltP and found out a bit.
Now i am trying to register a font. This is my code..
#include<iostream.h>
#include<graphics.h>
#include<io.h>
#include<process.h>
#include<stdlib.h>
#include<alloc.h>
#include<fcntl.h>
int main()
{
int a=0,b=5;
int handle;
unsigned fsize;
void *ayyhar;
handle = open("HARRYP.CHR",O_RDONLY,O_BINARY);
fsize= filelength(handle);
ayyhar = malloc(fsize);
if( read(handle, ayyhar, fsize) != fsize)
{cout<<"unable to read from file";
exit(1);
}
if( HP5_FONT != registerfarbgifont(ayyhar) ) //HP5_FONT is the public name i gave when converting chr file to obj using bgiobj.exe
{cout<<" unable to register file";
}
close (handle);
initgraph(&a, &b, " ");
settextstyle(HP5_FONT, 0, 4);
outtextxy(200, 100, "HELLO");
return(0);
}
I get an compiler error " undefined symbol HP5_FONT". Where should i define it ? I tried defining it along with the enumfontnames in graphics.h. But i don't know it's value. What valu should HP5_FONT have actually?
Aryabhata- the great Indian mathematician is also my historical hero.
You can move only one digit anywhere for example 110 -102 ( changed the place of 1 in 101).
You are not allowed to change the signs.
I have seen one UFO, i don't know whether it's really UFO or not it was just a point light that came out in the sky , it traveled in a v-shape and then it vanished. This was about an year ago. That time i felt that Stephen Hawkings theories were true.
Hi all,
Let's us solve some puzzles, Try his one...
#1
Rule: You are allowed to move only one digit among any one of the numbers such that it satisfies the equation 101 - 102 = 1 .
Hollywood's first movie studio was established in 1912. It will be celebrating it's 100 years jubilee next year.
My favorite Hollywood movie is Rocky series and favorite heroes are Arnold schwarzenegger, Sylvester stallone.
Post your favorite movie and the way it has affected your heart.
Hello sing1006,
You haven't initialized count1 in the main() and count can be used only in the main() (local scope).
Hello markee,
ASCII value of character 0 is 48 and '1' is 49. When you subtract these ASCII values you will get the required value 1.
For example,
char a;
int b;
b=int(a)-'0';
Alexander the great and Porus- the king of kings who fought against Alexander the great, are my historical heroes.
Thanks for the reply Waltp. My problem is how to get that font working using outtextxy(). Are the installed PC fonts compatible with Turboc++ ? Should i mention the chr file along with the default fonts in the header file or should i attach it somewhere ?
check on line 29 Wakesta, you have given return(0), but your function is of the type void.
Hello wakesta,
You are using getch() and gotoxy() functions functions, but you haven't included conio.h.
Hello all,
I need your help. I trying to change the font of texts displayed in the output of my program. I know that we can use settextstyle() for changing fonts. But there are only four types of fonts( GOTHIC, SANS SERIFF , TRIPLEX , DEFAULT) available. I want to use some other fonts like Lucida calligraphy and all other installed fonts in PC . Is there any way to do that? or should i change any thing in the header file graphics.h. I am using Turbo c++ .
Thanks all in advance!
Hello alex1050,
Try giving if-else statement for '-' also. I think then it would work.
Hello sms5660,
In the line 59 you have passed a parameter to the function option1(). But in the declaration of the function , you didn't make the function to accept integer values.
cout << option1(yearsUntilRetirement);
Hello ThrasherK,
I hope coursename is a string. In the line 10 you have declared coursename as character variable. Declare it as a pointer or as a character array.
I think there is a confusion between month(integer variable) and months(string).
As i said earlier if you give months[highest] you wont get error. If you get error then it would be because of this . You have given highest=values[0]; in line 40 but you haven't filled the values[ ] with integer values at all.
highest = "January";
highest is an integer variable. You can't assign a string to it. Try copying all the month names in the months[ ]
starting from month[1] using strcpy().
You have declared iochar as integer type variable. I think that's why you didn't get the output. Declare it as character type variable.
yes it repeats adding the number to itself(to variable product)several times.
Why? are you getting any errors. The if-else block in line 21 looks correct.
And also it should be == in the if-else (line 15) block as you are comparing the iochar with '\0' etc,.
if ((iochar=='\0')||(iochar=='\t')||(iochar=='\n'))
Hello thecodepixie,
In the for loop in line 37 use some if-else statements. For example
if(grid[i][j]==0)
{printf(" ");
}
else
{printf("%d ",grid[i][j]);
}
Hello tricket 7,
Already you have found the month with highest and lowest rainfall. So instead of giving highest in line 53 give months[highest]. Note that January will be in months[0]. So if highest is 1 then it will print February rather than January. You will have to make some changes there.
Hello alex1050,
In the line 15 it looks like '\o'(letter 'o') it should have been '\0'(zero).
Sorry it should have been subtracted with '0'.
char a[5]="2358";
int a;
a = ((a[0]-'0')*1000))+((a[1]-'0')* 100))+((a[2]-'0')*10)+(a[3]-'0');
Hello itslucky,
You can do as gerard4143 said or you an also do this.
Declare a character array. The values in the character array can be converted to integers by doing this.
char a[5]="2358";
int a;
a = ((a[0]-'\0')*1000))+((a[1]-'\0')* 100))+((a[2]-'\0')*10)+(a[3]-'\0');
Variable 'a' will have the integer 2358.
Hello francis25,
consider a set {2,2,2,2,2,2,2}, to find the sum of all elements in the set, you would count the number of 2's and multiply it with 2. You can also add all the 2's instead of multiplying and that's what is done in the code you posted. Variable i is used in the for loop so that the element is added up to the number of times it occurs.
Arbus you are an excellent programmer very professional
Thank you.
what is the purpose of the reverse? to switch from lower to upper and vice versa ?
Yes, if the character is in lower case, then it changes it to upper case and vice versa. The reverse function changes the case of the character. So the string will have alternate upper and lower case characters.
Hello cse.avinash,
There is no return statement on the function fun.
I hope you are printing the reversed string in the block(line 25-30).
You have given cout<<reverse(mysring, strlength) inside the loop and that's why you get the string printed multiple times. Give this instead of lines 25-34.
cout << "Your string reversed: ";
cout<<reverse(mystring, strlength);
for (int count = 0; count < strLength; count++)
{ cout << myString[count];
}
cout<<endl;
Try changing line 37-47 with this...
cout << "Your string in lowercase: ";
cout<<lower(mystring, strlength);
for (int count = 0; count < strLength; count++)
{
cout<<mystring[count];
}
cout<<endl;
similarly try doing this to line 50-58.
In my previous post i gave you an example of how to use tolower and toupper functions. Try changing it in the lower, upper and reverse functions.
An example...
char* lower (char * string, int SIZE)
{
for(int count = 0; count < SIZE; count++)
{
string[count]= tolower(string[count]);
}
return string;
}
Hope this helps.
And also in the function upper and lower when you are using tolower and toupper functions you should give
mystring[count]=touppper(mystrting[count]);
Then only mycount will have the character changed to uppercase or lowercase.
You have given all the lines in the for loop. I meant only the lines you want.
char* reverse (char * string, int SIZE)
{
for(int count = 0; count < SIZE; count++)
{
if (isupper(string[count]))
tolower(string[count]);
else if (islower(string[count]))
toupper(string[count]);
return string;
}
}
A function can return only one value. You should not give return inside the for loop.
char* reverse (char * string, int SIZE)
{
for(int count = 0; count < SIZE; count++)
{
if (isupper(string[count]))
tolower(string[count]);
else if (islower(string[count]))
toupper(string[count]);
}
return(string);
}
In the code below you have given the string mycount inside the for loop which does not get changed at all in the upper function.
upper(myString, strLength);
{
cout << "Your string in uppercase: ";
for (int count = 0; count < strLength; count++)
{
cout << myString[count];
cout << endl;
}
}
Instead of the above code above give
cout<<upper(mystring, strlength);
Hello shyla,
You didn't enclose the for loop with braces on line 30.
cout << "Your string reversed: ";
for (int count = 0; count < strLength; count++)
cout << reverse(myString, strLength);
cout << myString[count] = tolower;
Since you didn't do that, it will print the string sent by reverse() several times.
i've tried it, but i cant work on putting them together...
Hello spixy,
You have combined matrix addition and multiplication. Do them separately and there is no need of loop k.
c[i][j]+=x[i][k]*y[k][i];
>>Ancient dragon
int readVal(struct Telem* tm)
Can you explain this ? because telem is itself a structure.
sorry..
Got it.
You cannot give a variable in a1 = new int[n][n];. Constant expression should be given
a1= new int[4][4]
.
Hello winecoding,
You can pass 2d arrays as pointers.
int func(int **array1);
The function can now get a 2d array.
or
You can also pass arrays to a function like this.
int func(int a[][100]);
The size of the column should be given. You can call the function in the main like this.
int array1[100][100];
func(array1);
Nothing is useless or low, For each thing in its place has it's own value.
You gave i<=N in the for loop. If we take 6 then 1,2,3,6 are all added with sum rather than 1,2,3. That's why you get the wrong output.
Hello salty11,
There is a semicolon after for loop. You have terminated the loop.
for(i=1; i<=N; i++);
Hello xeno86,
Use fflush(stdin) before scanf for again as charley bones said. The loop doesn't work because as you press enter('\n') the '\n' is copied onto the variable again. You can also use flushall() before the scanf() for again.
Hello tamyln,
The problem lies with your calcactualamount funciton. You gave return amountp in a while loop. It's wrong. You should give return statement outside the loops. A function can return only one float value.
Use code tags.
Hello tailsthefox,
System("DIR") will display the directories of the drive and the number of free space available in bytes. But before doing system("DIR") you must change to the required drive. You need to include stdlib for executing system commands.
I hope the line 123 is function declaration for definition. I think this is the problem, you have terminated the definition by giving ';' .
From your errors it is clear that you have left ')' for function call in line 93 and 123, but regarding the error std::string it will be helpful if you post lines 93 and 123.
What is the error ? It's hard to guess the error about soFar with the error number.
Hello plang007,
In your calculator function you are passing the variable 'a' which is altered in the if else block above it. You are not passing the positive value which the user entered. Thats why you get 1 as the largest number when the user enters 2.
if ( a%2 == 0 )
{
a = a / 2;
sum = a + sum;
even ++;
}
Hello khoanyneosr,
I think you gave wrong function prototype for game function.
Try giving this in your function definition.
int game(string soFar, const string THE_WORD, int MAX_WRONG, int wrong, string used)
{
}
Try this as your prototype.
int game(string,const string,int,int,string);
or
Try declaring the variables soFar etc., again in the game function definition.
Hello yuyumerry,
Can you post your code ?