C++ :: Construct A Program Without Main Function That Output Stars
Nov 5, 2013
I am trying to construct a program without a main function that outputs stars but at the same time outputs the number and a colon after the number but before the number of star. This is the coding i have so far.
I have i want to call a function with two results for example x = 1 and y = 2.How do i return this function in c and how do i call such a function in the main program.
I'm having trouble with my for loop near the end of the program was able to print everything else.
Sample Output:
*** end of 27610_Arrays04.cpp program ***
City City Points --------------- 1---5----10---15---20 Belvidere ********** Freeport ******** Byron ************ Stillman Valley *************** Rockford *********
*** end of 27610_Arrays04.cpp program ***
Input:
TODO #1: complete the coding of the points array An integer array of 5 numbers: 10, 8, 12, 15, 9
TODO #2: complete the coding of the cities string array An string of 5 city names intialized to: "Belvidere", "Freeport", "Byron", "Stillman Valley", "Rockford"
Compile-time arrays with initialization lists.
Processing & Output:
TODO #3: complete the coding of the call to the printStars() function
TODO #4: code the printStars() function
#include <iostream> #include <iomanip> #include <string> using namespace std; int main(void) { /* declarations ------------------------------------------------*/
I am having trouble getting the stars to output correctly in the printStars function. the final output should look something like this:
#include <iostream> using namespace std; int readArray(int input[], int size); void printArray(int input[], int count); void printStars(int input[], int size);
How to construct a simple hash function ? When the program executes, it will ask for your name. Type your name and it will print out a "hash code" (a number) from that name.
Ok so I am working on a game and I'm in the process of developing my Player class. Anyways, what I have is a keyboard function that is called in my main function to make a shape move.
void myKeyboardFunction(unsigned char key, int x, int y) { switch ( key ) {
[Code].....
But when I try to call it, trying to copy my previous method,
glutKeyboardFunc(Player1.playerControls);
I get an error
error C3867: 'Player::playerControls': function call missing argument list; use '&Player::playerControls' to create a pointer to member
I get an error saying it can't convert parameters. I would just like to understand why the arguments become a problem when I make the function a member of my class, when the first method I used is so easy.
The function is supposed to return value from the file in my main, but I am getting empty value. I am trying to get better with pointer. Right now just teaching myself.
right now the only way for this code to show value is when in put the putchar(*ps) inside my readfile function. I would like to readfile to return value and print in the main function.
I am writing a program in which a Fucntion has to be wriiten to parse the Command Line . When I include Code for parsing in main fuction iteslf ,its run ok . But I want to make a fucntion of that code and call it from main ,than it show Segmentation error .
By using Debugging I found Some thing is mess with " -m" Parameter of Command line , But Cant Rectify it ..
Code: int main (int argc, char *argv[]){ //get_parameter_value(argc,argv); // buffer[packet_size+1]= char ("'"); while (argc > 1) { if (argv[h][0] == '-')
int example (int [], int, *int,*int,*int,*int); int main () { My code will be here example (int array[], int size, &a,&b,&c,&d); // Like this??? I try it didnt work
I need to split my main() function into two separate functions.Where would the best place be to split it up?
* Read a text file whose name is given on the command line, and for each word: * if it is an integer, insert it into an array in sorted order * if it is not an integer, insert it into an array of words.
* Notes: converted to use C++ strings, because C strings are messier. * Need to grow arrays, need to insert in sorted order. * Growing arrays might be done the way we grew a C string:
#include <iostream> #include <string> #include <ctime> // to use the time function #include <cstdlib> using namespace std; int getUserChoose (int);
[Code] ....
here is the output
Welcome to the program of Rock, Paper, Scissors The computer is ready to play the game Are you ready to play the game Y for yes and N for no Y R = Rock; P = Paper; S = Scissors R You have choose Rock 1TN 1RM 0U 0C
I'm currently writing a poker game and am trying my best to avoid using global variables. I have a few variables in int main() which i was hoping to use to store the value of each players hand. I then created a function which calculates the value of the hand but cannot get this value back into the main function.
For example:
Code: #include <iostream> using namespace std; void getValue(int value) { value = 4;
[Code] ....
Is there any way i can get the value of value using this function? If not what can I do?
This code is for a program that allows you to play a guessing game or arithmetic game and shows your total score from both as you go along. The program works fine the only problem I'm having is with the score. Is there a way to call the score value from the outside function into main?
So trying to pass the value of score from the outer function int guessGame() into the score print statement in choice 3 of the main function? Oh and the "17 -turn_count" was just part of the requirements of the assignment.
I am just practicing some recursion and I am having trouble with printing out a recursive function in main. Here is what I have:
Code:
// This function adds the squares 4, 5 = 4*4 + 5*5 recursiveley int recursive_sumSquares(int m, int n) { if (m < n) { return m*m + recursive_SumSquares(m+1, n); } else { return m*m;
[Code]...
I am getting an error that says undefined reference to 'recursive_SumSquares'
But how to define a shape (say a circle by that cir() function which is) outside of the main() function? And how to attach it to be visible on window win?
Get user input should be done in a function. The function should read the product number, price per unit, and quantity sold and return them to the main().
Display the value of product number, price per unit and quantyty sold in main().
I have simple LCd_call function . I am calling this function from main . I wanted to call this function once. problem i am facing here, When lcd_call function being called. It enter the cases but instead of staying paricular case it coming back and starting case 1 iteslf . for every 6s it change the case to 1:
I know how to define a shape (here, a rectangle) and attach it to a window in C++ as follows:
#include <Simple_window.h> void cir() { Circle c(Point(100,100),50); } int main() { Simple_window win(Point(100,100),600,400, "test"); Rectangle r(Point(100,100),Point(300,200)); win.attach(r); win.wait_for_botton(); }
But how to define a shape (say a circle by that cir() function which is) outside of the main() function? And how to attach it on the window win to be visible?