15,920,217 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 13527256 (Top 20 by date)
Member 13527256
24-Jan-18 10:31am
View
I used files for this task, and everything works perfectly.
Member 13527256
24-Jan-18 10:30am
View
I finally managed to find an answer to this question myself:
#include <cstdio>
#include <vector>
using namespace std;
int main()
{
FILE *f = fopen("input.txt", "r");
char a;
vector <char> v;
while (f != NULL && fscanf(f, "%c", &a) != EOF)
v.push_back(a);
fclose(f);
//
f = fopen("output.txt", "w");
fprintf(f, "%u", v.size());
return 0;
}
Member 13527256
19-Jan-18 10:08am
View
For example:
User inputs:
Hello, //enter
world!.
My program has to output 13.
But I`ve no idea, how should I make it stop waiting for input after '!'.
Member 13527256
19-Jan-18 9:48am
View
Deleted
My problem - is to input text - some strings. There can be any text given (look at the example) - some sentences, article from newspaper, short tale, etc. But the problem is that there are '\n' symbols at the end of each string, and I have absolutely no idea how to input all that thing in one string - neither cin nor scanf inputs it. In my code I think problem is in endless while operator, but I don`t have to know how to change that.
I know strlen function, that`s not the problem.
Member 13527256
19-Jan-18 9:47am
View
My problem - is to input text - some strings. There can be any text given (look at the example) - some sentences, article from newspaper, short tale, etc. But the problem is that there are '\n' symbols at the end of each string, and I have absolutely no idea how to input all that thing in one string - neither cin nor scanf inputs it. In my code I think problem is in endless while operator, but I don`t have to know how to change that.
I know strlen function, that`s not the problem.
Member 13527256
26-Nov-17 13:01pm
View
Deleted
I DON`T HAVE VALUES ENOUGH TO COMPLETE MY ALGORITHM!!! ON VALUES GIVEN TO ME IT WORKS PERFECT!!! don`t be nut!
Member 13527256
26-Nov-17 12:59pm
View
Then I might didn`t understand you correct. ALL elements mustn`t be divided by 7; all EVEN numbers mustn`t be divided by 3 moreover. So there might be uneven numbers, and they mustn`t be divided by 7.
Member 13527256
26-Nov-17 7:15am
View
Yes: but NOT divided by 7.
So:
(1) each item must NOT be exactly divided by 7
(2) each item must be exactly divided by 2
(3) each item must NOT be exactly divided by 3
Member 13527256
26-Nov-17 3:20am
View
Well, there can be any numbers you`d like: 87 3 36 63 78 68 44. They don`t have to be consecutive.
Member 13527256
26-Nov-17 2:38am
View
Deleted
The debugger won`t help me to deal with problems in my algorithm - and all my problems are in that. I tried many times, and I can`t see them. And that`s why I am asking other people to help me.
I`m not a beginner actually, and I know how to use debugger. On values given to me everything works perfectly.
Member 13527256
26-Nov-17 2:36am
View
Deleted
The debugger won`t help me to deal with problems in my algorithm - and all my problems are in that. I tried many times, and I can`t see them. And that`s why I am asking other people to help me.
I`m not a beginner actually, and I know how to use debugger. On values given to me everything works perfectly.
Member 13527256
26-Nov-17 2:31am
View
Yes, that IS my problem - to find mistakes in my algorithm. I tried many times, but I can`t see them, and that`s why I am writing to this website.
Member 13527256
26-Nov-17 2:29am
View
You input the size of array. Then you input numbers - elements of that array. Among those elements you have to find the longest succession of numbers, not divided by 7 and even numbers, not divided by 3. You have to output the length of this succession.
Member 13527256
26-Nov-17 2:22am
View
Deleted
it`s OK, the numbers divided by 7 don`t have to be even.
Member 13527256
25-Nov-17 9:53am
View
Debugger does not help you to find errors with answer in that case, when particular value is not given, and you have to think of billion causes. Here is that situation. I don`t have list of values; and believe me: I have tried to get over this problem for about two weeks when I finally found this website.
Member 13527256
25-Nov-17 9:43am
View
I have tested many values, and on each one everything works CORRECT. Maybe, there are some another values, which doesn`t work with this code, but I can`t find them.
Member 13527256
25-Nov-17 8:08am
View
THANK YOU VERY MUCH! After a billion of my tries to change it, the answer was that easy!
Member 13527256
25-Nov-17 5:17am
View
Well, I said that I`ve tested my program on many different values, and it worked. I`ve no idea on which value it does not work (crushes - was a mistake) as well as I`ve no idea why it actually doesn`t work.
I used to work in different group, where they started using cout/cin, new/delete because their tutor considers malloc/calloc and printf/scanf to be too old and inconvenient.
Actually, in previous group (about a year ago) I used to work with classes and even won a regional programing competition. But then I had to move to another city and my new tutor is not as good as my previous one (moreover, my current group has just started learning to code, so neither they nor tutor like me). Now I don`t usually have problems with coding (last week we had even more complicated task, which I did very fast), but this task I don`t really understand. I think this code should be correct and I can`t understand why it doesn`t work.
Member 13527256
25-Nov-17 4:39am
View
If you "know C++" then you know C - it's a subset of C++.
I now that, I mean that they use malloc(), calloc(), printf(), scanf() and etc., which I don`t know.
I just wanted other people to look through my code - for them it woutld be easier to find a mistake.
Member 13527256
18-Nov-17 7:20am
View
Thank you - I was working late at night yesterday and forgot about debugger) Actually, the problem was here:
for (auto i:v)
if (max <= i)
{
max = i;
ind = i;
}
ind should be increased by 1 on each iteration here.
Show More