Ask your own question, for FREE!
Computer Science 19 Online
OpenStudy (anonymous):

Hey everyone, I'm having a issue somewhere in a program I've been working on for class (I will post the code itself after this). "1>Random.cpp(1): error C2001: newline in constant" is the error I'm getting, and I'm not sure where I've gone wrong, so I would appreciate any help!

OpenStudy (anonymous):

Also, forgot to mention, it's C++ using Microsoft Visual 2010. Anyway, here's what I've got: #include "StdAfx.h #include <iostream> #include <string> using namespace std; int main(void) { //Declaring int min=0,max=0,sumo=0,sume=0,n,j=0,totalnum=0,ne=0,no=0; //Creating a cout statement so the user can input the number of integers the program will compile cout << "enter number of numbers to enter: "; cin >> totalnum; if(totalnum<=0)//This is to verify that a positive integer was entered { cout <<"Please enter a number at least greater than 1:"; cin>> totalnum; } else { do { cout << "enter number #"<< j+1; cin >> n; if(j==0) { min=max=n; j=1; } else { if(n>max) { max=n; } if(n<min) { min=n; } } if(n%2==0) { sume+=n; ne++; } else { sumo+=n; no++; } }while(j<totalnum); } cout << "max is " << max; cout << "min is " << min; cout << "number of odds is " << no; cout << "number of evens is " << ne; cout << "sum of odds is " << sumo; cout << "sum of evens is " << sume; cout << "integer average is " << (sume +sumo)/totalnum; return 0; }

OpenStudy (anonymous):

I figured out the issue with that, it was just the open parentheses at the top, I've got the program somewhat working how it's supposed to now, just have a couple of random things not going how they're supposed to.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!