49,757 Topics
| |
//Hi all,can you explain how to call this function in main. //i ask user to enter the number,like this is it correct in main,recursevely call function? bool isPrime(int n, int d); int main() { int number; cout <<"Enter number >= 1"; cin >> number; if(isPrime(number)) { return cout << "Yes"; … | |
So I have this programming assignment I'm doing for my structured programming class (using the C language) that gives me a segmentation fault error. I rewrote the assignment in C++ and it worked fine, but since the class uses C, I must get to the bottom of this and submit … | |
//Hi,can someone explain the meaning of [size -2],why not [size -1],if we narrowing the string int palindrome(char str[], int size); int main() { cout << "Enter a string: "; char str[20]; cin.getline(str,20,'\n'); cout << "The entered string " << ( (palindrome(str,strlen(str)+1))? "is":"is not" ) << " a Palindrome string." << … | |
I have an assignment to write a recursive function that takes one integer variable and output the integer in reverse order to the screen. I've tried converting it to a char array(c++ "string" class not allowed) but could not get a counter to work. I can reverse an int array … | |
#include <iostream> #include <conio> void main () { cout<<"rose mary"; getch(); } | |
I have a horizontal layout inside which i have added a group box. The group box is split using a QSplitter and contain a QListWidget and a QTextBrowser. I want to add two push buttons at the bottom right corner of the window to navigate inside the QTextBrowser. I'm adding … | |
prog6.h #include "340.h" #include "binTree.h" #ifndef H_PROG6 #define H_PROG6 const vector < int > A{ 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15 }; const vector < float > B{ 0.5, 1.75, -3, 4.25, 5.50, -6.75, 8, 9.25, -10.5 }; const vector < … | |
Hi. I'm trying to implement a stack in C++, but i got stuck Here's my code #include<iostream> #include<cassert> #include<cstdlib> using namespace std; template<class Type> class stackTDA { public: virtual void initializeStack() = 0; virtual bool isEmptyStack() = 0; virtual bool isFullStack() = 0; virtual void push(const Type& newItem) = 0; … | |
Using Visual Studio 2013 C++, I got compilation errors that I couldn't explain. The compilation errors were: *main.cpp(325): error C2601: 'FLAG' : local function definitions are illegal main.cpp(323): this line contains a '{' which has not yet been matched main.cpp(326): fatal error C1075: end of file found before the left … | |
down vote favorite I am currently working as a software developer. I studied science in college and used programming for a science project. However, I was able to obtain my first programming-related job a year ago due to connections. However, I am starting to hate the job (personal reasons, not … | |
I dont know how to writ this program at first: I should write whith "function" which is definition of this function is : fk(n) for e.g-----> 10 ! =3628800 "the lowest non zero degit value" of 10 ! is "8" 12 !=479001600 "the lowest non zero degit value" of 12 … | |
//Mad lib // Creates a story based upon user input #include <cstdlib> #include <iostream> #include <string> using namespace std; string askText(string prompt); int askNumber(string prompt); void tellStory(string name, string noun, int number, string bodyPart,string verb); int main() { cout << "Welcome to Mad Lib.\n\n"; cout << "Awnser the following questions … | |
hii :) I've seen alot in (void)func. that at the end of it they put (return;) why they put it ??what is the logical meaning of it ?? is it the same as (return0;) ?? actually it confused me alot :/ thanks ^_^ | |
Hi there, I am working on signature based IDS, for this I have captured the TCP/IP traffic through Wireshark and got a pcap file, I want to extract some fields from the packet itself. How do I do this? I have been searching through the Internet and got the idea … | |
As usual, after learning new stuff, I write on it. Yesterday I finished learning on "Functions in C++" and found that functions are very easy to learn and useful. Hope this tutorial helps beginners. # What is function? # Sometimes when we want to execute a specific task wherever it's … | |
I am using Eclipse and there is one strange error coming while building. In files, it is not showing any error but when I build it, it says **Description Resource Path Location Type Program "g++ -std=c++0x" not found in PATH test [Discovery Options] page in project properties C/C++ Problem ** … | |
hi ! I want to sum of digts on C++ but when get the nagative number give me the result if pastive number like when u write -98 answer u 17 not -17 #include<iostream> #include<math.h> using namespace std; int main(){ int N=0 ; cin>>N; int sum=0; while(N!=0){ sum += (N%10); … | |
Input: String of expression A21 (+-) BB6C Output: 1) String T (+-)T 2) file 000 | 121 001 | BB6C write the program with C++ | |
Hi, I have a Blackboard class and an Item class: void Blackboard::send(std::vector<std::string> msg, std::string to){ std::list<Subscriber*>::iterator p; for (p = subscribers.begin(); p != subscribers.end(); p++) { if ((*p)->getName() == to) //check if sender is subscribed { (*p)->update(msg); } else{ // reciever is not subscribed std::cout << "Can not find " … | |
hello . i have a task to make a program working by FIFO logic , i wanna help with it , i have to ask user to enter number of Slot then number of programs , then start add numbers i thinking a lot and used a lot of loops … | |
1>e:\aulia septa dinarti228\modul 1\final project uts\final project uts\final project uts.cpp(41): warning C4091: 'typedef ' : ignored on left of 'pasien::pasien' when no variable is declared. what is mean in error project ? | |
Hey guys, So I have this atm machine assignment. Everything is working great, except I don't know how to declare char. I want to be able to choose between a, b, c & d. I am still a beginner we only covered 1 chapter so far in class so I'm … | |
when compiling code from my main function ireceive the following error `error: conversion from 'rectangle*' to non0scalar type 'rectangle' requested` My code is quite simple; Here's my main function #include <iostream> #inclde "rectangle.h" using namespace std; int main() { rectangle rect = new rectangle(3,4); cout<<rect.area()<<endl; cout<<rect.perimeter()<<endl; return 0; } here's … | |
this is the question given by my lecturer :- Write a program to accept 5 students (names) and their respective test marks into an array or arrays. Sort them and print the lists in: a) alphabetical order b) mark ranks(from highest to lowest) and my input is enter name : … | |
Write a function ListSplit that will split a circular list containing an even number of nodes, say 2k, into two circular lists each of which contains k nodes. The function should have three parameters and should work so that the function call ListSplit(list,sub1,sub2); will create new lists pointed to by … | |
Hi! I'm trying to write a code for my arduino project. it's an SMS-based Led matrix display. I seem to have problems with SRAM memory because of the size of the code. can you help me optimize it? #include "cmap.h" #include <SIM900.h> #include <sms.h> #include <SoftwareSerial.h> #define INTEN 6500 //speed … | |
May someone help me.. A kilogram is 1000 grams. Write a program that will read the weight of a package oof butter and output the weight in kilograms, as well as the number of package of butter needed to yield 1 kilogram of butter. Your program should allow the user … | |
Let x be a node in SLL. Write a C++ function to delete the data in this node. Following this deletion, the number of nodes in the list is one less than before the deletion. Your function must run for O(1). | |
The father of C++, Bjarne Stroustrup took part in a live Q&A via Google Hangout-On-Air. The Q & A was moderated by Patrick S, one of the moderators from the C++ Google+ Community, and Brad Y., of Pearson Ed/InformIT. The Q&A session was a public event. PS:This is not your … |
The End.