C++ :: How To Output Special Symbols
Jan 30, 2012For example, how to output "Delta" (like a triangle) in C++?
View 13 RepliesFor example, how to output "Delta" (like a triangle) in C++?
View 13 RepliesMy 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
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: é, ú, ç, à, Ú, À, ...
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?
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.
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?
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]....
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] .....
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
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]...
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?
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] ....
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];
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.
I'm using Code Blocks but for some reason it doesn't process alt symbols. You know... alt symbols are like this: ☺♫↓☻♪♥↕. Code Blocks says that they're "invalid characters". Is there any attatchments or mods so Code Blocks can process them or will changing the settings?
View 1 Replies View RelatedI built a C++ static library using WatCom IDE. It compiles without error, but running WLIB on it produces the msg:
Warning! Library contains no external symbols My WatCom compiler host is windows, & target is DOS.
If I convert the Library to an .exe program, by adding a main(), it executes fine, So there seems to be something I'm missing in the IDE settings for building a .lib.
I'm making a program that prints a triangle of @ signs given rows (but not columns).
For example, the output with rows = 4 would be:
@@@@
@@@
@@
@
and rows = 3 would be:
@@@
@@
@
However, trying to make this has given me a program that does something similar (but not the same):
for example, with my current program rows = 4 outputs:
@@@@
@@@
@@
@
and rows = 3 gives
@@@
@@
@
It seems that it's just missing a space (and therefore a setw and setfill), but I found 2 problems:
1. The space needs to not apply to the first line.
2. I can't get it to make a space before each row without making a space between each column.
My current code is:
#include <iostream>
#include <iomanip>
using namespace std;
int main ( ) {
int rows;
[Code] ....
I have tried putting in << setws and << setfills of various values but it seems to always apply to between each column as well as at the start of each row- what do I do?
I need a function to check if the inputted string contains a colon. It has to be in an if loop as the condition.
View 1 Replies View Relatedhow to ask the user to input operating symbols like "+","-","*" and then use it to operate on the numbers. The user should be asked to input the symbols not like this
1.+
2.-
3.*
I'm experimenting, making a little client/server but when it cout's the buffer, it prints out random symbols.
Server
#include <iostream>
#include <windows.h>
#include <WinSock2.h>
int main() {
char buffer[1024];
WSAData wsa;
[Code] ......
I'm working on a program in C++ that is supposed to read in a file, store the content of the file into a 2D array, assign characters to each of the numbers in the array and store in a char array, and print both of these arrays. It's then supposed to go through the initial array and make sure that each number doesn't differ in value from it's neighboring numbers by more than 1, correct these errors by replacing these numbers with the value of the average of their neighbors, assign characters to this corrected array as it did before, and print both arrays.
The character assignments go as follows:
0=blank
1=.
2=,
3=_
4=!
5=+
6=*
7=#
8=$
9=&
I have the code written that opens the file and loads the array, but where to go from there. To me the obvious, although probably not best, way to do the assignments is to go through the array with a for loop and use a series of if statements to check for the value of the number at each index and assign the appropriate symbol.
Here is the code I have so far:
#include <iostream>
#include <fstream>
using namespace std;
int main() {
int size = 100, i, j;
prog >> size;
int **numArray = new int* [size];
[code].....
The breakpoints I am setting are not caught by the IDE. Any how I can recover that.
I used to know I can delete the sdf file and rebuild. Just to make sure...
So I need to make a program that prints a triangle of symbols in a certain direction.
For example: Code: How many rows? 3
@
@@@
@@@@@
How to do that. It's rare that I post without figuring anything out, but I'm just simply not sure. I have a program that prints a triangle in a similar direction, so maybe if I could get some hints as to what to do with that (HINTS, not direct source code) .
Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main ( ) {
[Code] .....
Code:
#include <stdio.h>#include <string.h>
int main() {
char pin [] = {1,2,3,4};
printf("%s",pin);
getchar();
}
the above code displays random symbols as opposed to 1234
for example having input "12345556asf87" we get "123456asf". I need to do this task with getchar and putchar, and the with strings. My programs aren't working
stream:
char c = 0, c_ = 0;
char flag = 0;
while ((c = getchar()) != '.')
{
[Code]....
I need to find 2 similar words in one sentence and i need to find how much symbols are between these two words. I can't figure out the algorithm.
For example sentence would be-
This is nice table and nice chair.
Similar words are- nice
Symbols between them are 11 or 8(dont know if space is count as symbol)
int main()
char text[200],*dist;
printf("Enter one sentence
");
gets(text);
Maybe first of all would be
dist=strtok(text, " ,.!?");
while(dist!=0)
{
printf("%s
", dist);
dist=strtok(NULL, " ,.!?");
}
and it wil output each word and maybe then can search for similar words if there would be 2 strings then i would use strstr but i dont know how to do with one string.