AWFUL
Why I can't use graphics.h in Dev Cpp
Amirali
Hi everyone
Amirali
I just have a quick question
Amirali
I have a project
and I have some constant Global variables how I can change them to local variables?
Amirali
I know its kind of silly question
Amirali
By Pointer?
Mat
Mat
Local variables have a totally different use case
Anonymous
Hi
Ritu Raj
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
string remove_vowel(string);
int main() {
string s;
getline(cin,s);
cout<<remove_vowel(s);
}
string remove_vowel(string str)
{
string q;int i,j=0;
for(i=0;str[i];i++)
{
if(str[i]!='a'&&str[i]!='e'&&str[i]!='i'&&str[i]!='o'&&str[i]!='u')
{
q[j]=str[i];
j++;
}
}
return q;
}
Ritu Raj
why this code giving output???
Dima
Why not
Ritu Raj
yeah exactly😅
Ritu Raj
why this code is *not giving output?
Ritu Raj
alita the battle angel😇😇
MᏫᎻᎯᎷᎷᎬᎠ
The string "q" is empty and not allocated
MᏫᎻᎯᎷᎷᎬᎠ
It's like an empty array called "x"
And then you write x[4]
MᏫᎻᎯᎷᎷᎬᎠ
This causes undefined behavior
Ritu Raj
ohk thanks lunatic.....
Ritu Raj
is there anyother way to solve this issue?
MᏫᎻᎯᎷᎷᎬᎠ
The second part of the loop(condition) must be:
i < str.length()
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
You can do this:
In if block
q += str[i]
MᏫᎻᎯᎷᎷᎬᎠ
Without the need of "j" counter
MᏫᎻᎯᎷᎷᎬᎠ
"+=" can add a character into the end of the string
MᏫᎻᎯᎷᎷᎬᎠ
So you add the non-vowels characters to the end of the "q" string Everytime
MᏫᎻᎯᎷᎷᎬᎠ
That would solve your problem
MᏫᎻᎯᎷᎷᎬᎠ
I had a bad thoughts when asked about another solution
Ritu Raj
thank you very much lunatic😊😊😊😊😊😊😊😊😊😊
Ritu Raj
it is working now!!!!!
Ritu Raj
i have been spending an hour to figure the problem
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
Ritu Raj
Ritu Raj
thank you again!!!!😇😇😇
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
Ritu Raj
Thank You vehlwn for page✌️✌️✌️
Sukuna
Hello
Kanchan
Hi
Anonymous
/get findprojects
Elnee
Repeat until die
Anonymous
What is The best C++ socket book ?
Talula
Talula
There are many kinds of sockets, TCP/IP sockets, web socket, serial port socket communication, plug and socket (physical)... etc. So which socket?
Anonymous
Anonymous
??
Which socket sould I learn ?
Dede
Approved!
Bross
https://www.reddit.com/r/programminghorror/comments/b1k2oe/just_found_this_dunno_if_madness_or_genius/
Talula
??
Which socket sould I learn ?
It doesn’t define which socket but as it’s talking about low level work it could be TCP/IP sockets, but as it’s talking about examples in Java it could be websockets.
Anonymous
Ariana
/warn ad
sambit
Escuse me please
sambit
Anybody ate here
Ariana
what
MᏫᎻᎯᎷᎷᎬᎠ
Azrul
Guys i want to ask something
Azrul
How we want to use link listed and the data we get from user??
Ludovic 'Archivist'
Azrul
For example I need to write a program that display student information based on their input
Azrul
But i need to do it in struct structure
#define CLEAR_BUFFER while ( getchar ( ) != ’ \n ’ )
Hello
Ariana
why include stdio.h when you can int 0x80
#define CLEAR_BUFFER while ( getchar ( ) != ’ \n ’ )
What is The best C++ socket book ?
Hmmm, begin with this : UNIX NETWORK PROGRAMMING BYGRICHARD STEVENS, BILL FENNER, ANDREW RUDOFF.
Ariana
why read when you can man
#define CLEAR_BUFFER while ( getchar ( ) != ’ \n ’ )
Azrul
How to sort variables (such as age) in descending order using struct
Ariana
you can’t
Ariana
struct just tells the compiler how to arrange memory
#define CLEAR_BUFFER while ( getchar ( ) != ’ \n ’ )
Many do in C ++ here
Ariana
srs?
Ludovic 'Archivist'
Yes
#define CLEAR_BUFFER while ( getchar ( ) != ’ \n ’ )
Hahahahaha
Ludovic 'Archivist'
qsort have a function call as overhead that std::sort doesn't have