main()
{
ofstream out;
out.open(filename, ios::nocreate | iso::out);
...
...
...
out.close();
...
return 0;
Type: Posts; User: sikamikaniko
main()
{
ofstream out;
out.open(filename, ios::nocreate | iso::out);
...
...
...
out.close();
...
return 0;
The autoexec.bat isn't good idea. There are many methods to skip the lines in it. The bios is good, but I think codefx wanted some program to put it at the start of windows - before everything. Like...
If You want to make some kind of code, might be this will help you :)
I have the program. How to send it to you?
#include<iostream.h>
main()
{
char ln[256];
cin >> ln;
cout << ln;
return 0;
}
Yes. Try this:
cin >> string1;
cout << string1;
or in case to cont how many of each mark there are, just in the while add IFs. Also create more integers for each mark:
int punkt=0;
int comma=0;
...
while...
{
if(letter==',')
...
I suggest to open the file and get chars like this:
char letter;
int count=0;
while(ptr_file.get(letter))
{
if(letter=='.' || letter==',' || letter=='!' || letter=='?')
yes, the function is returning only one variable. But it depends on the case which one to return. It will return only the one where the IF operator is true or if no IFs are tru, then it will return...
You have to set srand(time(NULL)); to NULL in every loop in case to get different random numbers.
Here's a code, that is working perfectly in one of my programs:
ln=countln(ln); //...
char get;
ofstream file_ptr;
file_ptr.open(file, ios::out);
while(file_ptr.get(get))
{cout << get;}
file_ptr.close();
Hope that was what you was looking for :)
Hi! There is another way to do that. First, why don't you use for instead while?
so:
while (isalpha(array[i]))
cout << "Don't enter letters" << endl;
Try this:
if(isalpha(array[i])==0)...
10x anyway :)
Hi all. If anyone knows how to get the date and store it in a char, pls tell me.
Use "for" instead "do/while" :
do
{
i[count]=99999;
count++;
}
while (count<30);
Use "for" instead "do/while" :
[code]
do
{
i[count]=99999;
count++;
}
while (count<30);
[\code]
So, first of all - this kill. U never use it.
Also, include string.h (I have used bc++ 3.1)
and at the end, I had no problems using your program. It asked me 10 times for my name, and then it...
I think, that if you have many actions with reading and writing to a file, than it is better to separate those actions in different functions. But in this case it is not important. Also, if You make...
while(get(text))
{ cout << text; }
Try it :)
So, that is the Idea. But, if You want somth else, please reply :)
You want :
- the user to input a number and instead of digits the user should see * ?
... is to store the input digits in an array. U can do it without pointers and such. But if you don't know the number of the inputs, then create a dynamic array. See the tutorial N14 I think on this...
to output like this {1,2,3}
do it
cout<<"{"<<arr[0]<<"," <<arr[1] etc. :)
Tell me how to count the CPU cycles :) Please, ofcourse :)
ask() should return 0 loke this:
<code>
if(number_of<1)
{cout<<"Invalid input"; return 0;}
return num_of;
</code>
:) Don't go farmering, pick something easier: beer/coffee and TV like me:)
You shoud declare the size of the array.