Hi,
I would like to read an empty line. I would like an effect which is similar to:
cout << "Press enter to continue."
getchar();
But I would like to do it with cin stream. Is it possible?...
Type: Posts; User: apacz
Hi,
I would like to read an empty line. I would like an effect which is similar to:
cout << "Press enter to continue."
getchar();
But I would like to do it with cin stream. Is it possible?...
Thanks for replies. I'm coding a program which simulates some kind of a process evaluation. And I would like to introduce "time" in this program, so it would give an illusion that some process really...
Hello,
I would like to make a delay in a program but I want to use something OS and API independent - I mean, is there any function in standard library of C++ to make something like that ? Or if...
Thanks for replies. In this time I will use template specialization.
Best regards.
Hi!
I have sucha situation:
class a
{
vector<int> v1;
vector<some_type> v2;
vector<some_type2> v3;
public:
template <class T> void f(T a)
while calling it (a program). I know how works argc, argv. I just asked if it's neat to use it when I'm coding in C++ - because I rather connect that mechanism with pure C. Probably "communicate"...
Hello,
I'm coding a program which I want to communicate with user while calling it. And is it neat to use int main(int argc, char *argv[]) in C++? Or maybe there are other, better technics in C++ to...
Thank you for help.
Hi,
I have to deal with a binary representation of a number, starting with most significant bit. The problem is that I don't have enough memory to keep the whole binary representation so I can't...
Thank you very much :).
because I have sucha code:
#include <stdio.h>
int main()
{
int s;
scanf("%d\n", &s);
getchar();
return 0;
Before my program quits, I would like a user to press enter before the program ends. I want to do something similiar to simple:
getchar();
but with using scanf();
Is there anyway of doing it like...
Ok, thx. So there is nothing bad in fclose(ptr) when ptr == stdin ? Do you know maybe something about my mem leak problem?
Regards,
apacz.
Well, my intension was to get a data from a file if it was gave while running program ("./a.out filename" situation) or to get a data from keyboard. So if there was no filename while running a...
My program should be run like this: ./a.out file_name
and now - if someone did just "./a.out" then he can input data from keyboard. But if argc > 1 (so he put file name) we try to open this file for...
Hello.
I have such a code:
FILE *plik;
if(argc > 1)
plik = fopen(argv[1], "r");
if(argc <= 1 || plik == NULL)
{
plik = stdin;
...
Thanks. But there is no way to make this overload look like: bool operator<(const bignum& rhs) ? Because your overload takes two arguments - what's the real difference between those two versions ?...
Hello,
I have to overload "<" and ">" operators. So I do:
bool bignum::operator<(const bignum& a)
{
// here is some code comparing *this and a.
}
now I want to use operator "<" to...
Hi,
I need to read a string from the input but I don't know the length of it. So I would like to read for example first 100 chars, then next 100 chars and so on, till '\n'. I though about using...
Thanks.
Thanks for replies.
Salem: I have a question to the middle part of this operator (Q.push(p(make_pair(i,j), make_pair(i,j))), 0). .push() doesn't return anything so this '0' is a real value of...
Hi,
I don't think that it obfuscates the code but it makes it shorter.
Regards,
apacz
Hello,
I have such a line:
mapa[i][j] == '1' ? dist[i][j] = 0, Q.push(p(make_pair(i,j), make_pair(i,j))) : dist[i][j] = 0x7fffffff ;
but it doesn't really work, I got an error:
Can anyone...
Hello,
I have next version of my program ;) :
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
#define MAXLEN 1000 /* Maksymalna...
I've also added wait() in parents' code:
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
#define MAXLEN 1000 /* Maksymalna dlugosc...