C/C++ :: Put Special Chars In A Message
Apr 10, 2014
I'm trying to put in my messages, in my program, some special chars but when i try something like the following code, i get the output below.
#include <stdio.h>
int main( ) {
printf("Trying this char: %c
", 160);
printf("Trying this char: %c
", 163);
return 0;
}
Output:
Trying this char: �
Trying this char: �
How can i put those special chars? I would like to use: é, ú, ç, à, Ú, À, ...
View 14 Replies
ADVERTISEMENT
Jan 30, 2012
For example, how to output "Delta" (like a triangle) in C++?
View 13 Replies
View Related
Apr 30, 2014
There are many libraries in C++, but how are they made?
For example: SDL, SFML, Open CV, STK
There are no special functions in C++ from which we can create such libraries, If I wanted to create a library that processes sound signals, how would I do that? How can I access the mic, speakers and process the signals.
Open CV processes videos but which functions does it use?
View 3 Replies
View Related
May 24, 2013
I have an array in a class with some numbers in a specific order. Now I want to create a set with references to that array ordered after the arrays content. I thought a solution could be something like
class Holder {
int o[10]= {1,5,7,2,3,8,4,9,6,0};
public:
set<int,my_order> m_s;
Holder() {
for(int i=0; i<10;i++) {
m_s.insert(i);
[Code] ....
How to create the my_order.
View 9 Replies
View Related
Feb 6, 2015
I have to make an email validation program and i am halfway done. I only have one more problem, consider the ff. example:
Enter email:
myemail.@something.com //this is the input
Invalid //this should be the output
How can i determine if there is a special character near the '@' sign? and vice versa?
View 4 Replies
View Related
May 15, 2014
how to rearrange lists in an special manner.
I have heard about the hashset but I do not fully understand how that thing works or if it is the best option for this issue.
Basically I have 3 lists: LIST1, LIST2 and LIST3.
LIST1 is a set of xyz points and LIST2 shows how the points are connected (clockwise, counter clockwise, coolinear).
For example the fact that in the first line of LIST2 appears 0, 1, 2,-1 means that the points in LIST1 are connected as follows:
(0 0 128.588459085565)->(25 0 134.979628462965)->(0 0 134.979628462965)
Same for line2 of LIST2: 1, 4, 2,-1
(25 0 134.979628462965)->(25 0 140.100717207301)->(0 0 134.979628462965)
etc...
The value -1 at the end of each line does not mean anything but I need to keep it.
Finally LIST3 tells me if the points are connected counterclockwise (-1), clockwise (1), or coolinear (0).
The thing is that I want to get things as follows:
If the values of list 3=1 then I need to extract all the points in the list 1 that correspond to the value 1 in order. However the values in LIST2 cannot keep being 1, 4, 2,-1 they need to be reorganised starting by zero. Expected result in LIST2= 0,3,1,-1.
We need to do this for each value in list3 (1,-1 and 0).
The idea is to get 3 groups of values:
- Group 1 including all the values that are clockwise (list3) with the points in order in list1 and showing connections starting from zero on in list2.
- Group 2 including all the values that are counterclockwise (list3) with the points in order in list1 and showing connections starting from zero on in list2.
- Group 3 including all the values that are coolinear (list3) with the points in order in list1 and showing connections starting from zero on in list2.
The idea is to be able to print 3 files in the following way:
FILE1:
Points which are clockwise in LIST 1
...
Connections of those points in LIST 2
...
FILE2:
Points which are counterclockwise in LIST 1
[code]....
View 5 Replies
View Related
Feb 22, 2012
Code:
Exercise. 1.5 A number is special if it is divisible (no remainder) by 15. A number is big if it is greater than 999. A number is weird if it is divisible by 5 and 6 but not 18. A number is scary if it is big or weird.
Write a program to check which of the following, 450, 540, 600, and 675 are special but not scary.
Declare four variables called special, big, weird, and scary and make suitable assignments to these variables as a number is tested.
I want to do it with a function, but it just output that everything is Special and Scary, and that everything values 4199536.
Code:
#include <stdio.h>
#include <stdlib.h>
/* Function */
int test(int);
int test(int a) {
int sc, sp;
[Code] .....
View 5 Replies
View Related
Jun 1, 2013
Let assume that there is an array of integer numbers in the range from 1 to N that are located in the ascending order. For example
#include <iostream>
#include <numeric>
#include <iterator>
int main() {
const size_t N = 20;
[Code] .....
How can it be converted using some one standard algorithm such a way that the resulted sequence would look like
1 3 5 7 9 11 13 15 17 19 20 18 16 14 12 10 8 6 4 2
View 19 Replies
View Related
Nov 28, 2012
I have a file that contain different content, some lines inside that file looks like that :
Time : xx:xx:xx
Time : xx:xx:xx
So, I want to grab lines that start with "Time : " and put them inside a list<string> for later use. I am using windows so I don't know if the newline character is '
' or '
' also I don't want my grabed line contain any special character.
I have this code, but didn't work well because some special characters remain inside the string.
Code:
string buf;
list<string> ls;
ifstream read("test.txt", ios_base::binary);
while(!read.eof())
{
getline(read,buf,'
[Code]...
View 1 Replies
View Related
Mar 24, 2014
In my app the user can select the pages to print by typing in a start and an end page. I think this is the standard dialog.
How can I give the user the possibility to select e.g. page "1,2,6-9" like in Word?
View 4 Replies
View Related
May 23, 2013
My code is currently reads in a string of lower case letters, identifying the occurrence of each letter.
Code:
#include <stdio.h>
#include <string.h>
int main()
{
[Code]....
My issue is that I want my code to read uppercase and special symbols. showing the occurrence of both.
Code:
else if(str[x] >= 'a' && str[x] <= 'z');
else if(str[x] >= '0' && str[x] <= '9');
However I struggle to implement it
View 3 Replies
View Related
Nov 1, 2013
I am a beginner and I ALWAYS have the toughest time doing I/O files. It's extremely frustrating. It "seems" it should be so simple. The program should find a code from a list of numbers. These numbers are from 0 - 9, and after each number is a space in the file. Your job is to extract a special code containing only 10 of those numbers. For the number to be part of the code, it should be divisible by 2. After extracting 10 numbers divisible by 2 for the code, write those 10 numbers to the file to form the expected code.
Input file is ("question.txt")
Output should be ("code.txt")
Should this contain a "for loop" or If/else ?
Here's what I did . .
/
// int numbers, total, counter;
ifstream inFile;
inFile.open ("question.txt");
outFile.open ("code.txt");
if (!inFile)
[Code] ....
View 2 Replies
View Related
Sep 18, 2014
I'm searching a program that can detect a special type of memory leaks, like these:
int a = 12;
char c[10];
char cc = c[a];
View 8 Replies
View Related
Mar 5, 2013
How can I pass ":" or " " as an argument to a process?
I start a process which takes an IP and port number (ex 222.240.224.131:80) as argument. Another character that I want to pass is white space character. Both of these characters cuts the argument string and sends only the part that leads them.
View 1 Replies
View Related
May 20, 2013
I'm looking for a algorithm to search portions of string that have the same caracter. The only possible values are: a,n and g
Char index: 0 1 2 3 4 5 6 7 8 9 RESULT
------------------------------------------
Example 1: a g g g a a 0,4
Example 2: g g g a n n a 0,3
Example 3: a g g g g g g a 0,7
Example 4: g g g g g g g 0,6
Example 5: g g a a g a a a g 0,2,3,5,7,8
View 4 Replies
View Related
Sep 23, 2014
This is for homework . Must use only getchar and putchar
Code:
int main(void) {
int pch; //first
int ch; //second
[Code]....
And it works , but i need to hit ENTER two times when i have 3,5,7... chars to print result.
View 6 Replies
View Related
Apr 13, 2013
I'm working on a homework project, and it requires me to read in a file of chars into an array, and then do stuff with that array.
Anyways, I have the first part written, where I'm just trying to read in my data.txt file, and I thought I had it written well. It compiles, but then it seg faults, and I'm not sure why. I used calloc for the array, but maybe I misused it? Or is it in my EOF statement? I'm still not sure if that's coded correctly. I need to get past this so I can start testing the other parts of my code.
Code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[] ) {
/* Local Declarations*/
int i;
int *ptr;
char tempc;
[Code] .....
View 1 Replies
View Related
Sep 27, 2013
I am trying to convert some chars to UTF-8 strings...
Example:
std::string gethex(char c) {
/* EXAMPLE
if (c == 'é')
return "%c3%a9";
I need a function that converts chars like "á, é, í, ã" to UTF-8 hexadecimal strings...
*/
}
[Code] .....
[URL] .... does it. Choose UTF-8, type some character and click 'Url Encode'.
View 14 Replies
View Related
Jul 1, 2014
I am trying to do this but it can never seem to work.
#include <iostream>
using namespace std;
int main () {
char charOne;
cin.get(charOne);
cin.ignore(1000, '
[Code] .....
Basically i want to keep looping until i enter an a or A (also does this apply to if statements as well?)
View 6 Replies
View Related
Feb 10, 2014
I'm writing a school assignment that writes/reads user input into and out of a binary file.
I've gotten the write part to work, but now I need to be able to read that file back in and display it as a string.
I think I should be using fread() and read my file into an array of int's right? But when I try printing out that array I get a whole bunch of numbers that don't match the hex code in my file.
How do I read in a binary file and print it out as a string?
View 4 Replies
View Related
Aug 7, 2014
I have a problem with my code. I just have to reverse the chars of a string, but it adds a /n that I can't delete.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ch05Ex05._5 {
[Code] ....
View 5 Replies
View Related
Mar 31, 2012
I found this method
Code:
TCHAR win_getch()
(below) on a website which is used for printing the characters as the keys on keyboard are hit i-e without hitting the ENTER key. This method is used in a while loop like this
Code:
while ((c = win_getch()) != 13)
{}
I wanted to know why is the character compared to
Code:
13
i-e
Code:
if((c = win_getch()) != 13) then do something
Code:
/**
* This function will simulate the getch() function from conio.h.
* Note that this does not work for special keys like F1-F12, arrow keys,
* even the ESC key does not seem to work with this function.
* @return TCHAR read from input buffer.
*/
TCHAR win_getch() {
DWORD mode;
TCHAR theChar = 0;
[code]....
View 2 Replies
View Related
Apr 3, 2013
I am having difficulty completing 7th last line below I marked the line with an arrow.
Code:
int main(void) {
int MaxNum, /*number of random nos to generate */
i, /*index */
value,
[Code].....
View 4 Replies
View Related
Jan 29, 2014
lets say we have a txt that contains this
| | | | |*| |
| | | |*| | |
and that symbolizes a 2x6 char array and we want to take only the symbols inside the || and place them in a 2x6 char array. how do we do that?
View 1 Replies
View Related
Jan 13, 2014
As a part of a program I am supposed to write, I would like to receive a string from the user (for example: "Hi my name is Joe").
obviously, the string is inserted to an array of chars (arr[0]='H', arr[1]='i', arr[2]=' ',... and so on).
What I would like to do, is to put each word separately in each array cell (for example arr[0]='Hi', arr[1]="my"..., and so on). How can I do this? (I can not use any functions, unless I write them myself).
View 8 Replies
View Related
Jan 7, 2014
How to give input with text for this function.i already create function for this but i dn't know give input as non ASCII value(0-32) that Cobain with string or simple text.
View 1 Replies
View Related