Матin Salehizade
Write a program that receives a string with a maximum length of 100 characters from the user and sends it to the ChgStr function, this function removes the spaces in the string and counts the number of k letters in the string. This number as well as the new string will be printed in the main function after removing the space. * C language Friends, anyone knows this?
.
https://stackoverflow.com/questions/1726302/remove-spaces-from-a-string-in-c#:~:text=on%20this%20post.-,The%20easiest%20and%20most%20efficient%20way%20to%20remove%20spaces%20from,%22helloworld%22%20%2C%20and%20presto! https://stackoverflow.com/questions/61666703/how-to-count-only-letters-in-string
Матin Salehizade
Is that a homework or an assignment?
That is a question of final exam of semister, why ?
Матin Salehizade
Goodluck
But the exam locked us very good.
MaaKa
Hi, does anyone know why im getting the error "expected declaration or statement at the end of input"? Here's the part of my code: for(i=0; i<num; i++) { fprintf(fp, "%d %s %s %s %s %s %s\n",sPui[i].puiid, sPui[i].name, sPui); }
Are you supposed to put fprintf or just print... And When printing Are you supposed to pass value in front of the datatype or after calling the datatype. Like you used (fp, “%d And so on .
klimi
That is a question of final exam of semister, why ?
as per groups rules, asking home homeworks and assigments is forbidden
MaaKa
not good solution
What’s the right solution
klimi
What’s the right solution
getting input as int seems weird
MaaKa
getting input as int seems weird
What data type do you think is perfect for getting the value?
klimi
What data type do you think is perfect for getting the value?
> recieves maximum 100 characters - maybe char array?
MaaKa
Char for letters ( a , b , c , d …) Can’t use char there
MaaKa
And using array won’t do the job either For example: using array goes like this . datatype Array_name [ here u pass in values eg 1,2,3,4] datatype = Int Char Float Double Array_name = program Values = 1,2,3…
Матin Salehizade
as per groups rules, asking home homeworks and assigments is forbidden
How is it forbidden that you're already discussing for a better solution !?
klimi
How is it forbidden that you're already discussing for a better solution !?
it is forbidden to ask for them: • You should not ask exams/homework/interviews solutions. This will get you banned.
klimi
Ok.
you have read and agreed to the rules before posting, so don't act surprised
\Device\NUL
Are you trollin ?
MaaKa
Are you trollin ?
Not really Since I came here to learn while sharing my skills as well
\Device\NUL
\Device\NUL
Did you know characters are represented in value ?
MaaKa
Definitely
MaaKa
But they only display the ascii values
\Device\NUL
But they only display the ascii values
Then explain dis printf(“ Enter up to 100 characters ”); scanf(“%d”, &program);
\Device\NUL
Unicode chars also represented as bytes
Anonymous
Unicode chars also represented as bytes
Actually, Unicode characters are two bytes long each.
Anonymous
Yes wchar_t is 16 bits
What does wchar_t mean? Are there other types like that one?
\Device\NUL
Anonymous
You don't know wide characters ?
Yes, I do, but what does the t mean?
\Device\NUL
Yes, I do, but what does the t mean?
indicating the type is typedef like uint32_t, size_t
\Device\NUL
There are wchar.h header and also uchar.h headers which defines char32_t and char16_t typedefs and there are on standards
Anonymous
indicating the type is typedef like uint32_t, size_t
OK. Does t mean that it’s a custom type?
\Device\NUL
OK. Does t mean that it’s a custom type?
The ISO Commitee typedef-ing stuffs with *_t suffix
\Device\NUL
Suffix. Not prefix.
Sorry, suffix
Anonymous
Sorry, suffix
It’s OK. You just forgot.
Anonymous
Living, would you mind telling me how to register a keystroke event in C++?
Anonymous
If it’s possible, of course.
\Device\NUL
\Device\NUL
In plain old C, then?
On Windows maybe using win32 APIs or using termios stuff on *nix
\Device\NUL
Idk, haven't go further
Harshith
Hello guys
Anonymous
On Windows maybe using win32 APIs or using termios stuff on *nix
How is registering a keystroke different from cin or scan()?
Harshith
Can anybody please help me with this question
Harshith
I have an exam now and the group is not allowed to send the media files
\Device\NUL
How is registering a keystroke different from cin or scan()?
They interact with the console first then the console goes to send input to the buffer,
\Device\NUL
Whereas keystrokes go straight to the buffer?
Not really, the consoles/terminal processing the user input first
Anonymous
Not really, the consoles/terminal processing the user input first
Well, I’d like to make a programming language in which events (such as keystrokes or fatal exceptions) are a primitive type (and therefore get a reserved word to define them).
Anonymous
Who can explain how I can make copy and swap in a class to appropriate one class object to another?
Leovan
how to cast pointer to string? for example: int * ptr; // = 0xadf51ff8fc // after cast std::string ptr_str; // = "0xadf51ff8fc"
Leovan
Incompatible type, std::string is not scalar types
how std::cout convert pointers to text then 🤔
\Device\NUL
how std::cout convert pointers to text then 🤔
std::cout has a way to handles object unlike printf
\Device\NUL
even though it has .c_str() method, it will be desctructed after use
Ибраги́м
https://github.com/Snaipe/libcsptr
Phoenix
I am having problems in operation containing very small numbers (x ≃ 0). I think gcc compiler round off the number and expression gives totally different value. So is there's any way to solve this ?
Nir
void stringcopy(string s) { string str; int i, j; for (i = 0; s[i] != '\0'; i++) { str[i] = s[i]; } str[j] = '\0'; cout << "string copied!!!\n" << str; }
\Device\NUL
You could just str = s to copy std::string
Nabil
Hi guys, I need to parallelize a C code with MPI, I need some help please.
Chat Boss
ahmet samir sent a code, it has been re-uploaded as a file
ahmet
where is the mistake
-
Hi everyone I have a question I want to take a long string as an input and then split it according to spaces The length of string is not clear Any idea ?
klimi
Hi everyone I have a question I want to take a long string as an input and then split it according to spaces The length of string is not clear Any idea ?
try getting some fixed size, if it is not enough, make another buffer or extend your current one, and try reading the rest; and repeat
DaviChan
Hi everyone I have a question I want to take a long string as an input and then split it according to spaces The length of string is not clear Any idea ?
input from file or command line? Are you using C or C++? How long is long exactly? More than a couple gigabytes?