![]() |
| | #1 |
| Registered User Join Date: Nov 2009 Location: London UK
Posts: 3
| Problem with inserting Character. I have had some assignment work to do. On this i have finished the code and everything works, so dont worry im not asking for the solution because of student type lazyness! I have one line in my code Code: printf("Please insert the value in £: ");
Question - Is there a simpler method of inserting £ so that the user knows which currency to be inserting. Thanks in advance! |
| Caerleon is offline | |
| | #2 |
| Registered User Join Date: Sep 2006
Posts: 2,517
| It depends on what your char set is set up to handle. Try this: Code: printf("\n Please insert the value in %c: ", 156);
|
| Adak is offline | |
| | #3 |
| Registered User Join Date: Oct 2006 Location: Canada
Posts: 848
| Use the Unicode codepoint for it, i.e. Code: printf("\u00A3\n");
|
| nadroj is offline | |
| | #4 |
| Registered User Join Date: Nov 2009 Location: London UK
Posts: 3
| |
| Caerleon is offline | |
| | #5 |
| Registered User Join Date: Nov 2008
Posts: 75
| |
| MisterIO is offline | |
| | #6 |
| Registered User Join Date: Mar 2003
Posts: 3,844
| |
| Codeplug is offline | |
| | #7 |
| Registered User Join Date: Nov 2009 Location: London UK
Posts: 3
| I tried both solutions, but was looking for a simpler method as my professor needs to read the source code aswell as see the output. With the second suggestion i dont think i put it in the proper place as it errored, so i used the first suggested method. Thanks anyway. |
| Caerleon is offline | |
| | #8 |
| Registered User Join Date: Mar 2003
Posts: 3,844
| Your highest probability of success - for reasons listed in the link I provided - is the following: Code: #include <stdio.h>
#include <locale.h>
const wchar_t pound = L'\u00a3';
int main()
{
setlocale(LC_ALL, "");
printf("pound = %lc\n", pound);
return 0;
}
|
| Codeplug is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem about Character Constant of \t | userpingz | C++ Programming | 3 | 06-24-2009 03:30 AM |
| C language and NULL character problem | ndru_w | C Programming | 4 | 11-23-2007 09:42 AM |
| Game Pointer Trouble? | Drahcir | C Programming | 8 | 02-04-2006 02:53 AM |
| Problem with character arrays in classes | spoketoosoon | C++ Programming | 3 | 03-16-2004 03:57 AM |
| Comparing Character Arrays problem... | newy100 | C++ Programming | 4 | 11-16-2003 07:54 PM |