skipcount C++

Write your question here.
having issues trying to get it to run need help asap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  #include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

void Pause() 
{ char junk; 
  cout << "Press Enter to continue ... "; 
  cin.ignore(10000,'\n');
 // cin.ignore();  // ignore everything no matter what;
  cin.get( junk); 


int main()
{
	// declare variables
	bool done;
	int count, number, skipValue;

	
// init the loop
	  count = 0;
	  done = count >= 7;
	  // get starting number and skip value
	  cout << "Enter a number? ";
	  cin >> number;
      cout << "Enter a skip value? ";
	  cin >> skipValue;

while ( !done)
     {
       // display number
	      cout << number; 
			  
			  if ( count >6)
				  { cout << ", ";
		          }
			  else
			     { } // do nothing
		  
       // add skip value
	      number = number + skipValue;
		  
	   /// update the exit condition
	  count = count + 1;
	  done = count >= 7;
      	
      cout << endl;
	  // freeze screen
	  Pause();
	

	return 0;
}
What kind of issues are you having?

It appears that you may have a missing brace or two at a quick glance.

ya after looking through it i figured that out that's what was keeping it from running
having issues trying to get it to run

Getting it to compile without errors is an even bigger problem.

Missing closing braces, two of them, would solve the compiling problem.

One brace before main() to close off your Pause() function.

The second one is a bit harder to say where, either line 49 or line 53.

Fix that and it will compile.

cin.ignore(10000,'\n');
That doesn't extract and discard everything, just 10,000 characters in the stream. That works only if there are 10,000 or less characters still in the stream.

10,000 works because most compilers don't set the maximum size very high. I don't recall the standard setting what the size of a stream has to be. If an C++ implementation chooses to set a higher limit then your std::cin.ignore() version doesn't work properly.

If you want to ignore the characters to the maximum size of the stream, not matter what the implementation does:
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
Make sure to include <limits>.
Topic archived. No new replies allowed.